tr
[options
] [string1
[string2
]]
Copy standard input to standard output, performing
substitution of characters from string1
to string2
or deletion of characters in string1
.
Complement characters in string1
with ASCII 001-377.
Delete characters in string1
from output.
Squeeze out repeated output characters in string2
.
Change uppercase to lowercase in a file:
cat file | tr `[A-Z]` `[a-z]`
Turn spaces into newlines (ASCII code 012):
tr ' ' '\012' <file
Strip blank lines from file and save in new.file (or use \011 to change successive tabs into one tab):
cat file | tr -s "" "/012" > new.file
Delete colons from file; save result in new.file:
tr -d : <file > new.file