TR(1) COMMAND REFERENCE TR(1)
NAME
tr - translate characters
SYNOPSIS
tr [ -cds ] string1 string2 ] ]
DESCRIPTION
Tr copies the standard input to the standard output with
substitution or deletion of selected characters. Input
characters found in string1 are mapped into the
corresponding characters of string2. When string2 is short
it is padded to the length of string1 by duplicating its
last character. Any combination of the options -cds may be
used.
In either string, the notation a-e means a range of
characters from a to e in increasing ASCII order. The
backslash character (\) followed by one, two, or three octal
digits stands for the character whose ASCII code is given by
those digits. A backslash (\) followed by any other
character stands for that character.
OPTIONS
-c Complements the set of characters in string1 with
respect to the universe of characters whose ASCII codes
are 01 through 0377 octal.
-d Deletes all input characters in string1.
-s Squeezes all strings of repeated output characters that
are in string2 to single characters.
EXAMPLES
The following example creates a list of all the words in
file1 one per line in file2, where a word is taken to be a
maximal string of letters. The second string is quoted to
protect the backslash (\) from the Shell. 012 is the ASCII
code for newline.
tr -cs A-Za-z '\012' <file1 >file2
RETURN VALUE
[NO_ERRS] Command completed without error.
[USAGE] Incorrect command line syntax. Execution
terminated.
CAVEATS
Printed 10/17/86 1
TR(1) COMMAND REFERENCE TR(1)
Will not handle ASCII NUL in string1 or string2; always
deletes NUL from input.
Characters in a string that do not appear to be a legitimate
range (a-e) will be interpreted literally. For example, e-a
will be interpreted as a string composed of the characters
e, -, and a.
SEE ALSO
ed(1), expand(1), ascii(7).
Printed 10/17/86 2
%%index%%
na:72,61;
sy:133,159;
de:292,920;
op:1212,452;
ex:1664,405;
rv:2069,227;
ca:2296,51;2491,346;
se:2837,158;
%%index%%000000000140