Quick links About tr Syntax Examples Related commands Linux / Unix main page About tr Translate characters. Syntax tr [-c] [-d] [-s] [string1] [string2]
| -c | Complement the set of characters specified by string1. |
| -d | Delete all occurrences of input characters that are specified by string1. |
| -s | Replace instances of repeated characters with a single character. |
| string1 | First string or character to be changed. |
| string2 | Second string or character to change the string1. |
Examples echo "12345678 9247" | tr 123456789 computerh - this example takes an echo response of '12345678 9247' and pipes it through the tr replacing the appropriate numbers with the letters. In this example it would return computer hope. tr -cd '\11\12\40-\176' < myfile1 > myfile2 - this example would take the file myfile1 and strip all non printable characters and take that results to myfile2. Related commands ed sed sh |