[0m


TR(1)		    UNIX Programmer's Manual		    TR(1)



[1mNAME
     [0mtr - translate characters

[1mSYNOPSIS
     tr [0m[[1m-dcs0[0m] [ _s_t_r_i_n_g_1 _s_t_r_i_n_g_2 ]
     [1mtr -d[0m[[1mcs0[0m] _s_t_r_i_n_g_1

[1mDESCRIPTION
     [0m_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 [1m-cds [0mmay be used: [1m-c
     [0mcomplements the set of characters in _s_t_r_i_n_g_1 with respect to
     the universe of characters whose ASCII codes are 01 through
     0377 octal; [1m-d [0mdeletes all input characters in _s_t_r_i_n_g_1; [1m-s
     [0msqueezes all strings of repeated output characters that are
     in _s_t_r_i_n_g_2 to single characters.

     If [1m-d [0mis not given _s_t_r_i_n_g_2 must be supplied if _s_t_r_i_n_g_1 is
     not empty.

     In either string the notation _a[1m-[0m_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' one per line in `file2', where a word is taken to be
     a maximal 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

     If the ASCII NUL character is not specified in either
     _s_t_r_i_n_g_1 or _s_t_r_i_n_g_2 any NUL characters in the input will be
     removed.  This behaviour is for backwards compatibility and
     may be prevented using the [1m-0 [0mflag.

[1mOPTIONS
     -c   [0mReplace _s_t_r_i_n_g_1 with all the characters in the range
	  \001 to \377 (in that order) less those in the original
	  _s_t_r_i_n_g_1.

     [1m-d   [0mDelete all input characters which are members of
	  _s_t_r_i_n_g_1.

     [1m-s   [0mAfter deleting or converting the input characters
	  replace sequences of a character from _s_t_r_i_n_g_2 with a



Printed 30/4/92     Revision 1.3 of 11/10/90			1






TR(1)		    UNIX Programmer's Manual		    TR(1)



	  single instance of that character.

     [1m-0   [0mDo not automatically delete ASCII NUL characters from
	  the input.

[1mSEE ALSO
     [0m_e_d(1), _a_s_c_i_i(7), _e_x_p_a_n_d(1).
















































Printed 30/4/92     Revision 1.3 of 11/10/90			2



[0m