TR(1) DOMAIN/IX SYS5 TR(1)
NAME
tr - translate characters
USAGE
tr [ -cds ] [ string1 [ string2 ] ]
DESCRIPTION
Tr copies the standard input to the standard output after
substituting or deleting selected characters. Input charac-
ters found in string1 are mapped into the corresponding
characters of string2. Any combination of the options
listed below may be used.
The following abbreviation conventions may be used to intro-
duce ranges of characters or repeated characters into the
strings:
[a-z] Stands for the string of characters with ASCII
codes running from character a to character z
inclusive.
[a*n] Stands for n repetitions of a. If the first digit
of n is 0, n is considered octal; otherwise, n is
considered decimal. A zero or missing n is inter-
preted as huge; this facility is useful for pad-
ding string2.
The backslash escape character (\) may be used as it is in
the Shell to remove special meaning from any character in a
string. In addition, a backslash followed by 1, 2, or 3
octal digits represents the character whose ASCII code is
given by those digits.
OPTIONS
-c Complement the set of characters in string1 with
respect to the universe of characters whose ASCII
codes are 001 through 377 octal.
-d Delete all input characters in string1.
-s Squeeze all strings of repeated output characters
in string2 to single characters.
EXAMPLE
The following example creates a list of all the words in
file1 and places them one per line in file2, where a word is
taken to be a maximal string of alphabetics. The strings
are quoted to protect the special characters from interpre-
tation by the Shell; 012 is the ASCII code for newline.
Printed 12/4/86 TR-1
TR(1) DOMAIN/IX SYS5 TR(1)
# tr -cs ``[A-Z][a-z]'' ``[ 12*]'' <file1
CAUTIONS
Tr cannot handle ASCII NUL in string1 or string2. It always
deletes NUL from input.
RELATED INFORMATION
ed(1), sh(1), ascii(5).
TR-2 Printed 12/4/86