'\"macro stdmacro
.if n .pH g1.tr @(#)tr	40.5 of 8/10/89
.nr X
.if \nX=0 .ds x} tr 1 "BSD Compatibility Package" "\&"
.if \nX=1 .ds x} tr 1 "BSD Compatibility Package"
.if \nX=2 .ds x} tr 1 "" "\&"
.if \nX=3 .ds x} tr "" "" "\&"
.TH \*(x}
.SH NAME
\f4tr\f1 \- translate characters
.SH SYNOPSIS
\f4/usr/ucb/tr\f1
\f1[\f4 \-cds \f1]
[
.I string1
[
.I string2
] ]
.SH DESCRIPTION
.P
\f4tr\f1
copies the standard input to the standard output
with substitution or deletion of selected characters.
The arguments
.I string1
and
.I string2
are considered sets of characters.
Any input character found in
.I string1
is mapped into the character in the corresponding position within
.IR string2 .
When
.I string2
is short, it is padded to the length of
.I string1
by duplicating its last character.
.P
In either string the notation:
.RS
\f2a\f4\-\f2b\f1
.RE
.P
denotes a range of characters from
.I a
to
.I b
in increasing
.SM ASCII
order.
The character
\f4\e\|\f1,
followed by 1, 2 or 3 octal digits stands for the character whose
.SM ASCII
code is given by those digits.
As with the shell, the escape character
\f4\e\|\f1,
followed by any other character, escapes any special meaning for that
character.
.SH OPTIONS
.P
Any combination of the options
\f4\-c\f1,
\f4\-d\f1,
or
\f4\-s\f1
may be used:
.TP
\f4\-c\f1
Complement the set of characters
in
.I string1
with respect to the universe of characters whose
.SM ASCII
codes are 01 through 0377 octal.
.TP
\f4\-d\f1
Delete all input characters in
.IR string1 .
.TP
\f4\-s\f1
Squeeze all strings of repeated output characters that are in
.I string2
to single characters.
.SH EXAMPLE
.P
The following example creates a list of all the words in
.I filename1
one per line in
.IR filename2 ,
where a word is taken to be a maximal string of alphabetics.
The second string is quoted to protect
\f1`\f4\|\e\|\f1'
from the shell.
012 is the
.SM ASCII
code for
.SM NEWLINE\s0.
.IP
\f4tr \-cs A\-Za\-z \'\e012\' <\|\f2filename1\f4>\|\f2filename2\f1
.SH "SEE ALSO"
\f4ed\fP(1)
in the \f2User's Reference Manual\f1.
.br
\f4ascii\fP(5)
in the \f2System Administrator's Reference Manual\f1.
.SH NOTES
Will not handle
.SM ASCII NUL
in
.I string1
or
.I string2.
\f4tr\f1
always deletes
.SM NUL
from input.
.Ee
