Tr (Unix)

From Free net encyclopedia

(Difference between revisions)

Current revision

Template:Lowercase

tr (abbreviated from translate or transliterate) is a command in Unix-like operating systems.

When executed, the program reads from the standard input and writes to the standard output. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set. The following inputs, for instance, (equivalent to tr abcdefghijklmnopqrstuvwxyz zabcdefghijklmnopqrstuvwxy) shift the input letters of the alphabet back by one character.

$ echo "ibm 9000" > computer.txt
$ tr [a-z] [za-y] < computer.txt
hal 9000

tr is an operator in Perl as well, which operates analogously.

See also

External links

Template:Unix-stubde:Tr fr:Tr (unix)