|
|
1.1 root 1:
2:
3: tr Command tr
4:
5:
6:
7:
8: Translate characters
9:
10: ttrr [-ccddss] _s_t_r_i_n_g_1 [_s_t_r_i_n_g_2]
11:
12: tr reads characters from the standard input, possibly translates
13: each to another value or deletes it, and writes to standard out-
14: put.
15:
16: Each specified string may contain literal characters of the form
17: a or \b (where b is non-numeric), octal representations of the
18: form \ooo (where o is an octal digit), and character ranges of
19: the form X-Y. tr rewrites each string with the appropriate con-
20: versions and range expansions.
21:
22: If an input character is in string1, tr outputs the corresponding
23: character of string2. If string2 is shorter than string1, the
24: result is the last character in string2.
25:
26: The following flags control how ttrr translates characters:
27:
28: -cc Replace string1 by the set of characters not in string1.
29:
30: -dd Delete characters in string1 rather than translating them.
31:
32: -ss The ``squeeze'' option: map a sequence of the same character
33: from string1 to one output character.
34:
35: ***** Example *****
36:
37: The following example prints all sequences of four or more spaces
38: or printing characters from infile:
39:
40:
41: tr -cs ' -~' '\12' <infile | grep ....
42:
43:
44: Here string1 is the range from <ssppaaccee> to `~', which includes all
45: printing characters. Because this example uses the flags -cs, tr
46: maps sequences of nonprinting characters to newline (octal 12).
47:
48: ***** See Also *****
49:
50: ASCII, commands, ctype, sed
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.