MiniUnix/usr/man/man1/tr.1
.th TR I 5/20/74
.sh NAME
tr \*- transliterate
.sh SYNOPSIS
.bd tr
[
.bd \*-cds
] [ string1 [ string2 ] ]
.sh DESCRIPTION
.it Tr
copies the standard input to the standard output with
substitution or deletion of selected characters.
Input characters found in
.it string1
are mapped into the corresponding characters of
.it string2.
Any combination of the options
.bd \*-cds
may be used.
.bd \*-c
complements the set of characters in
.it string1
with respect to the universe of characters
whose ascii codes are 001 through 377 octal.
.bd \*-d
deletes all input characters in
.it string1.
.bd \*-s
squeezes all strings of repeated output characters that are
in
.it string2
to single characters.
.s3
The following abbreviation conventions may be used
to introduce ranges of characters or repeated characters into
the strings:
.s3
\fB[\fIa\*|\fB\*-\fIb\fB\*|]\fR
stands for the string of characters whose ascii codes run
from character
.it a
to character
.it b.
.s3
\fB[\fIa\fB\*|*\fIn\fB\*|]\fR,
where
.it n
is an integer or empty, stands for \fIn\fR-fold
repetition of character
.it a.
.it n
is taken to be octal or decimal according as its
first digit is or is not zero.
A zero or missing
.it n
is taken to be huge;
this facility is useful for padding
.it string2.
.s3
The escape character `\\' may be used as in
.it sh
to remove special meaning from any character in a string.
In addition,
`\\' followed by 1, 2 or 3 octal digits stands for the
character whose ascii code is given by those digits.
.s3
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 strings are quoted
to protect the special characters from interpretation by the Shell;
012 is the ascii code for newline.
.s3
.ti +8
tr \*-cs "[A\*-Z][a\*-z]" "[\\012*]" <file1 >file2
.sh "SEE ALSO"
sh (I), ed (I), ascii (V)
.sh BUGS
Won't handle ascii NUL in
.it string1
or
.it string2;
always deletes NUL from input.