1TR(1) User Commands TR(1)
2
3
4
6 tr - translate or delete characters
7
9 tr [OPTION]... SET1 [SET2]
10
12 Translate, squeeze, and/or delete characters from standard input, writ‐
13 ing to standard output.
14
15 -c, -C, --complement
16 use the complement of SET1
17
18 -d, --delete
19 delete characters in SET1, do not translate
20
21 -s, --squeeze-repeats
22 replace each sequence of a repeated character that is listed in
23 the last specified SET, with a single occurrence of that charac‐
24 ter
25
26 -t, --truncate-set1
27 first truncate SET1 to length of SET2
28
29 --help display this help and exit
30
31 --version
32 output version information and exit
33
34 SETs are specified as strings of characters. Most represent them‐
35 selves. Interpreted sequences are:
36
37 \NNN character with octal value NNN (1 to 3 octal digits)
38
39 \\ backslash
40
41 \a audible BEL
42
43 \b backspace
44
45 \f form feed
46
47 \n new line
48
49 \r return
50
51 \t horizontal tab
52
53 \v vertical tab
54
55 CHAR1-CHAR2
56 all characters from CHAR1 to CHAR2 in ascending order
57
58 [CHAR*]
59 in SET2, copies of CHAR until length of SET1
60
61 [CHAR*REPEAT]
62 REPEAT copies of CHAR, REPEAT octal if starting with 0
63
64 [:alnum:]
65 all letters and digits
66
67 [:alpha:]
68 all letters
69
70 [:blank:]
71 all horizontal whitespace
72
73 [:cntrl:]
74 all control characters
75
76 [:digit:]
77 all digits
78
79 [:graph:]
80 all printable characters, not including space
81
82 [:lower:]
83 all lower case letters
84
85 [:print:]
86 all printable characters, including space
87
88 [:punct:]
89 all punctuation characters
90
91 [:space:]
92 all horizontal or vertical whitespace
93
94 [:upper:]
95 all upper case letters
96
97 [:xdigit:]
98 all hexadecimal digits
99
100 [=CHAR=]
101 all characters which are equivalent to CHAR
102
103 Translation occurs if -d is not given and both SET1 and SET2 appear.
104 -t may be used only when translating. SET2 is extended to length of
105 SET1 by repeating its last character as necessary. Excess characters
106 of SET2 are ignored. Only [:lower:] and [:upper:] are guaranteed to
107 expand in ascending order; used in SET2 while translating, they may
108 only be used in pairs to specify case conversion. -s uses the last
109 specified SET, and occurs after translation or deletion.
110
112 Written by Jim Meyering.
113
115 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
116 Report any translation bugs to <https://translationproject.org/team/>
117
119 Copyright © 2019 Free Software Foundation, Inc. License GPLv3+: GNU
120 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
121 This is free software: you are free to change and redistribute it.
122 There is NO WARRANTY, to the extent permitted by law.
123
125 Full documentation <https://www.gnu.org/software/coreutils/tr>
126 or available locally via: info '(coreutils) tr invocation'
127
128
129
130GNU coreutils 8.31 March 2019 TR(1)