tr
Linux · Text · available in the simulator
What it does
Translate or delete characters.
Syntax
tr [opciones] conjunto1 [conjunto2]
Options and parameters
-dDelete characters in the specified set.
tr -d '\r' < archivo.txt-sReplace each sequence of repeated characters with a single occurrence.
tr -s ' '-cUse the complement of the specified set.
Usage examples
echo hola | tr a-z A-Zecho 'a b c' | tr -d ' 'tr -s ' ' < archivo.txttr -d '\r' < archivotr -d '\r' < archivo.txttr -s ' '
Notes and common mistakes
- Only reads from standard input; used with pipes or redirections.
- Typical example: echo hola | tr a-z A-Z