Note that in order to use the tr command on a file, you must redirect the file into the tr command, like so, because the tr command does not accept files as arguments:

tr 'a-z' 'A-Z' <file

Important options include the following:

Option

Description

-d

Used when the second set is omitted; it deletes the matching characters. For example, the following deletes all numbers from the output of the date command: date | tr -d '0-9'.

-s

Repeated matching characters are converted into a single character before being translated. Thus, “aaabc” would be converted into “abc” and then translated to “Abc” if the command tr -s 'a' 'A' were executed.