Copies from standard input to standard output, while substituting one set of characters with another.
tr [options] string1 [string2]
-c complements characters in string1 with ASCII codes 001–377.
-d deletes from the input all characters specified in string1.
-s replaces repeated sequences of any character in string1 with a single character.
The tr command substitutes all characters in string1 in the input with the corresponding characters in string2. For example, to convert the file sample.lc to all uppercase and store in sample.uc, type the following:
tr [a-z] [A-Z] < sample.lc > sample.uc
To replace repeated occurrences of newlines in a file with a single newline character, type the following:
tr -s ‘\n’ < infile > outfile