1TR(1)                            User Commands                           TR(1)
2
3
4

NAME

6       tr - translate or delete characters
7

SYNOPSIS

9       tr [OPTION]... STRING1 [STRING2]
10

DESCRIPTION

12       Translate, squeeze, and/or delete characters from standard input, writ‐
13       ing to standard output.  STRING1 and STRING2 specify arrays of  charac‐
14       ters ARRAY1 and ARRAY2 that control the action.
15
16       -c, -C, --complement
17              use the complement of ARRAY1
18
19       -d, --delete
20              delete characters in ARRAY1, do not translate
21
22       -s, --squeeze-repeats
23              replace  each sequence of a repeated character that is listed in
24              the last specified ARRAY, with a single occurrence of that char‐
25              acter
26
27       -t, --truncate-set1
28              first truncate ARRAY1 to length of ARRAY2
29
30       --help display this help and exit
31
32       --version
33              output version information and exit
34
35       ARRAYs  are  specified  as strings of characters.  Most represent them‐
36       selves.  Interpreted sequences are:
37
38       \NNN   character with octal value NNN (1 to 3 octal digits)
39
40       \\     backslash
41
42       \a     audible BEL
43
44       \b     backspace
45
46       \f     form feed
47
48       \n     new line
49
50       \r     return
51
52       \t     horizontal tab
53
54       \v     vertical tab
55
56       CHAR1-CHAR2
57              all characters from CHAR1 to CHAR2 in ascending order
58
59       [CHAR*]
60              in ARRAY2, copies of CHAR until length of ARRAY1
61
62       [CHAR*REPEAT]
63              REPEAT copies of CHAR, REPEAT octal if starting with 0
64
65       [:alnum:]
66              all letters and digits
67
68       [:alpha:]
69              all letters
70
71       [:blank:]
72              all horizontal whitespace
73
74       [:cntrl:]
75              all control characters
76
77       [:digit:]
78              all digits
79
80       [:graph:]
81              all printable characters, not including space
82
83       [:lower:]
84              all lower case letters
85
86       [:print:]
87              all printable characters, including space
88
89       [:punct:]
90              all punctuation characters
91
92       [:space:]
93              all horizontal or vertical whitespace
94
95       [:upper:]
96              all upper case letters
97
98       [:xdigit:]
99              all hexadecimal digits
100
101       [=CHAR=]
102              all characters which are equivalent to CHAR
103
104       Translation occurs if -d is not given and both STRING1 and STRING2  ap‐
105       pear.   -t  may  be  used only when translating.  ARRAY2 is extended to
106       length of ARRAY1 by repeating its last character as necessary.   Excess
107       characters of ARRAY2 are ignored.  Character classes expand in unspeci‐
108       fied order; while translating, [:lower:] and [:upper:] may be  used  in
109       pairs  to  specify case conversion.  Squeezing occurs after translation
110       or deletion.
111

BUGS

113       Full support is available only for safe single-byte locales,  in  which
114       every  possible input byte represents a single character.  The C locale
115       is safe in GNU systems, so you can avoid this issue  in  the  shell  by
116       running LC_ALL=C tr instead of plain tr.
117

AUTHOR

119       Written by Jim Meyering.
120

REPORTING BUGS

122       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
123       Report any translation bugs to <https://translationproject.org/team/>
124
126       Copyright  ©  2022  Free Software Foundation, Inc.  License GPLv3+: GNU
127       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
128       This is free software: you are free  to  change  and  redistribute  it.
129       There is NO WARRANTY, to the extent permitted by law.
130

SEE ALSO

132       Full documentation <https://www.gnu.org/software/coreutils/tr>
133       or available locally via: info '(coreutils) tr invocation'
134
135
136
137GNU coreutils 9.1                January 2023                            TR(1)
Impressum