Documented in Volume 1 of the UNIX Programmers Manual.
% tr -cs A-Za-z '\012' < file1 > file2
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 second string is quoted to protect `\' from the shell.
012 is the ascii code (in octal) for newline.
% tr A-Z a-z
will read from standard input and translate all upper case characters
into lower case.
% tr -d '\015' < in > out
will read from file 'in', deleting all CTRL-M (carriage return) characters
and storing the result into file 'out'. 015 is the ascii code (in octal)
for carriage return.
% tr -d '\001-\011\013-\037' < junk > JUNK
will read from the file junk, delete all control characters (except newline,
of course), and store the results into the file JUNK.
From: S. P. Kemp
The ASCII character set:
........B.a.s.e....... Key- Character
10 8 16 stroke mnemonic Meaning
--- --- --- ------- ------- ----------
0 0o 00h CTRL-@ NUL ^@ Null, idle
1 1o 01h CTRL-A SOH ^A Start of Heading
2 2o 02h CTRL-B STX ^B Start of text
3 3o 03h CTRL-C ETX ^C End of text
4 4o 04h CTRL-D EOT ^D End of transmission
5 5o 05h CTRL-E ENQ ^E Enquiry
6 6o 06h CTRL-F ACK ^F Acknowledge
7 7o 07h CTRL-G BEL ^G Bell, beep
8 10o 08h CTRL-H BS ^H Backspace
9 11o 09h CTRL-I HT ^I Tab (horizontal)
10 12o 0Ah CTRL-J LF ^J Line feed (newline)
11 13o 0Bh CTRL-K VT ^K Vertical tab
12 14o 0Ch CTRL-L FF ^L Formfeed (page eject)
13 15o 0Dh CTRL-M RETURN ^M Carriage return
14 16o 0Eh CTRL-N SO ^N Shift out
15 17o 0Fh CTRL-O SI ^O Shift in
16 20o 10h CTRL-P DLE ^P Data link escape
17 21o 11h CTRL-Q DC1 ^Q Device control 1
18 22o 12h CTRL-R DC2 ^R Device control 2
19 23o 13h CTRL-S DC3 ^S Device control 3
20 24o 14h CTRL-T DC4 ^T Device control 4
21 25o 15h CTRL-U NAK ^U Negative Acknowledge
22 26o 16h CTRL-V SYN ^V Synchronous idle
23 27o 17h CTRL-W ETB ^W End transmission block
24 30o 18h CTRL-X CAN ^X Cancel
25 31o 19h CTRL-Y EM ^Y End of medium
26 32o 1Ah CTRL-Z SUB ^Z Substitute
27 33o 1Bh ESC ESC ^[ Escape, prefix, altmode
28 34o 1Ch FS ^\ File separator
29 35o 1Dh GS ^] Group separator
30 36o 1Eh CTRL-^ RS ^^ Record separator
31 37o 1Fh US ^_ Unit separator
32 40o 20h SP Space, blank
33 41o 21h ! Exclamation mark, "bang"
34 42o 22h " Doublequote
35 43o 23h # Pound sign, hashmark
36 44o 24h $ Dollar sign
37 45o 25h % Percent sign
38 46o 26h & Ampersand
39 47o 27h ' Apostrophe, quote
40 50o 28h ( Left parenthesis
41 51o 29h ) Right parenthesis
42 52o 2Ah * Asterisk, star
43 53o 2Bh + Plus sign
44 54o 2Ch , Comma
45 55o 2Dh - Dash, hyphen, minus sign
46 56o 2Eh . Period, dot
47 57o 2Fh / Slash, stroke
48 60o 30h 0 Zero
49 61o 31h 1 One
50 62o 32h 2 Two
51 63o 33h 3 Three
52 64o 34h 4 Four
53 65o 35h 5 Five
54 66o 36h 6 Six
55 67o 37h 7 Seven
56 70o 38h 8 Eight
57 71o 39h 9 Nine
58 72o 3Ah : Colon
59 73o 3Bh ; Semicolon
60 74o 3Ch < Less-than,left angle bracket
61 75o 3Dh = Equal sign
62 76o 3Eh > Greater-than,right angle bracket
63 77o 3Fh ? Question mark
64 100o 40h @ "At" sign
65 101o 41h A
66 102o 42h B
67 103o 43h C
68 104o 44h D
69 105o 45h E
70 106o 46h F
71 107o 47h G
72 110o 48h H
73 111o 49h I
74 112o 4Ah J
75 113o 4Bh K
76 114o 4Ch L
77 115o 4Dh M
78 116o 4Eh N
79 117o 4Fh O
80 120o 50h P
81 121o 51h Q
82 122o 52h R
83 123o 53h S
84 124o 54h T
85 125o 55h U
86 126o 56h V
87 127o 57h W
88 130o 58h X
89 131o 59h Y
90 132o 5Ah Z
91 133o 5Bh [ Left square bracket
92 134o 5Ch \ Backslash, reverse stroke
93 135o 5Dh ] Right square bracket
94 136o 5Eh ^ Up arrow, hat, caret, circumflex
95 137o 5Fh _ Underscore, left arrow
96 140o 60h ` Back-quote, accent grave
97 141o 61h a
98 142o 62h b
99 143o 63h c
100 144o 64h d
101 145o 65h e
102 146o 66h f
103 147o 67h g
104 150o 68h h
105 151o 69h i
106 152o 6Ah j
107 153o 6Bh k
108 154o 6Ch l
109 155o 6Dh m
110 156o 6Eh n
111 157o 6Fh o
112 160o 70h p
113 161o 71h q
114 162o 72h r
115 163o 73h s
116 164o 74h t
117 165o 75h u
118 166o 76h v
119 167o 77h w
120 170o 78h x
121 171o 79h y
122 172o 7Ah z
123 173o 7Bh { Left brace (curly bracket)
124 174o 7Ch | Vertical bar, pipe
125 175o 7Dh } Right brace (curly bracket)
126 176o 7Eh ~ Tilde
127 177o 7Fh DELETE Delete, rubout