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 Will not handle ASCII NUL in string1 or string2; always deletes NUL from input. Printed 4/6/89 1
TR(1) COMMAND REFERENCE TR(1) 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), and ascii(7). Printed 4/6/89 2
%%index%% na:192,77; sy:269,215; de:484,996; op:1480,498; ex:1978,434; rv:2412,271; ca:2683,198;3145,232; se:3377,192; %%index%%000000000142