tr—Translate or delete characters
tr [-cst] [–complement] [–squeeze-repeats] [–truncate-set1] string1 string2
tr f-s,–squeeze-repeatsg [-c] [–complement] string1
tr f-d,–deleteg [-c] string1
tr f-d,–deleteg f-s,–squeeze-repeatsg [-c] [–complement] string1 string2
GNU tr also accepts the –help and –version options.
This manual page documents the GNU version of tr. tr copies the standard input to the standard output, performing one of the following operations:
- Translate and optionally squeeze repeated characters in the result
- Squeeze repeated characters
- Delete characters
- Delete characters, then squeeze repeated characters from the result.
The string1 and (if given) string2 arguments define ordered sets of characters, referred to below as set1 and set2. These sets are the characters of the input that tr operates on. The –complement (-c) option replaces set1 with its complement (all of the characters that are not in set1).