|
|
1.1 root 1: .\" @(#)tr.1 6.2 (Berkeley) 9/3/88
2: .\"
3: .TH TR 1 "September 3, 1988"
4: .AT 3
5: .SH NAME
6: tr \- translate characters
7: .SH SYNOPSIS
8: .B tr
9: [
10: .B \-cds
11: ] [ string1 [ string2 ] ]
12: .SH DESCRIPTION
13: .I Tr
14: copies the standard input to the standard output with
15: substitution or deletion of selected characters.
16: Input characters found in
17: .I string1
18: are mapped into the corresponding characters of
19: .IR string2 .
20: When
21: .I string2
22: is short it is padded to the length of
23: .I string1
24: by duplicating its last character.
25: Any combination of the options
26: .B \-cds
27: may be used:
28: .B \-c
29: complements the set of characters in
30: .I string1
31: with respect to the universe of characters
32: whose ASCII codes are 0 through 0377 octal;
33: .B \-d
34: deletes all input characters in
35: .I string1;
36: .B \-s
37: squeezes all strings of repeated output characters that are
38: in
39: .I string2
40: to single characters.
41: .PP
42: In either string the notation
43: .IB a \- b
44: means a range of characters from
45: .I a
46: to
47: .I b
48: in increasing ASCII order.
49: The character
50: `\e' followed by 1, 2 or 3 octal digits stands for the
51: character whose ASCII code is given by those digits.
52: A `\e' followed by any other character stands
53: for that character.
54: .PP
55: The following example creates a list of all
56: the words in `file1', each on a separate line, in `file2',
57: where a word is taken to be a string of alphabetics.
58: The second string is quoted
59: to protect `\e' from the Shell.
60: 012 is the ASCII code for newline.
61: .IP
62: tr \-cs A\-Za\-z \'\e012\' <file1 >file2
63: .SH "SEE ALSO"
64: ed(1), expand(1), ascii(7)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.