diff options
Diffstat (limited to 'static/unix-v10/man1/tr.1')
| -rw-r--r-- | static/unix-v10/man1/tr.1 | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/static/unix-v10/man1/tr.1 b/static/unix-v10/man1/tr.1 new file mode 100644 index 00000000..3a8dd75e --- /dev/null +++ b/static/unix-v10/man1/tr.1 @@ -0,0 +1,86 @@ +.th TR I 9/24/73 +.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. +If +.it string2 +is short, it is padded with corresponding characters from +.it string1. +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 not 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(VII) +.sh BUGS +Won't handle ascii NUL. +.br +Also, Kernighan's Lemma can really bite you; +try looking for strings which have \\ and * in them. |
