tr Command Examples

Translate characters: run replacements based on single characters and character sets. More information: https://www.gnu.org/software/coreutils/tr.

tr {{find_character}} {{replace_character}} < {{path/to/file}}

echo {{text}} | tr {{find_character}} {{replace_character}}

tr '{{abcd}}' '{{jkmn}}' < {{path/to/file}}

tr -d '{{input_characters}}' < {{path/to/file}}

tr -s '{{input_characters}}' < {{path/to/file}}

tr "[:lower:]" "[:upper:]" < {{path/to/file}}

tr -cd "[:print:]" < {{path/to/file}}