4.3BSD-Reno/share/man/cat1/tr.0
TR(1) 1988 TR(1)
NNAAMMEE
tr - translate characters
SSYYNNOOPPSSIISS
ttrr [ --ccddss ] [ string1 [ string2 ] ]
DDEESSCCRRIIPPTTIIOONN
_T_r copies the standard input to the standard output with
substitution or deletion of selected characters. Input
characters found in _s_t_r_i_n_g_1 are mapped into the correspond-
ing characters of _s_t_r_i_n_g_2. When _s_t_r_i_n_g_2 is short it is pad-
ded to the length of _s_t_r_i_n_g_1 by duplicating its last charac-
ter. Any combination of the options --ccddss may be used: --cc
complements the set of characters in _s_t_r_i_n_g_1 with respect to
the universe of characters whose ASCII codes are 0 through
0377 octal; --dd deletes all input characters in _s_t_r_i_n_g_1; --ss
squeezes all strings of repeated output characters that are
in _s_t_r_i_n_g_2 to single characters.
In either string the notation _a--_b means a range of charac-
ters from _a to _b in increasing ASCII order. The character
`\' followed by 1, 2 or 3 octal digits stands for the char-
acter whose ASCII code is given by those digits. A `\' fol-
lowed by any other character stands for that character.
The following example creates a list of all the words in
`file1', each on a separate line, in `file2', where a word
is taken to be a string of alphabetics. The second string
is quoted to protect `\' from the Shell. 012 is the ASCII
code for newline.
tr -cs A-Za-z '\012' <file1 >file2
SSEEEE AALLSSOO
ed(1), expand(1), ascii(7)
Printed 7/27/90 September 1