Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

tr

Some strings on this page have not been translated yet. You can help by translating them on Weblate.
v0.13.0
tr [OPCIÓN]... CONJUNTO1 [CONJUNTO2]

Traducir o eliminar caracteres

Options

-A
--complement, -c, -C

use the complement of SET1

--delete, -d

delete characters in SET1, do not translate

--squeeze-repeats, -s

replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character

--truncate-set1, -t

first truncate SET1 to length of SET2

-u

do not buffer output

Traducir, comprimir y/o eliminar caracteres de entrada estándar, escribiendo a salida estándar.

Examples

Sustituye todas las apariciones de un carácter en un archivo e imprime el resultado:

tr <{{ruta/al/archivo}} {{find_character}} {{replace_character}}

Sustituye todas las apariciones de un carácter de la salida de otro comando:

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

Mapea cada carácter del primer conjunto al carácter correspondiente del segundo:

tr <{{ruta/al/archivo}} '{{abcd}}' '{{jkmn}}'

Elimina todas las apariciones del conjunto de caracteres especificado de la entrada:

tr <{{ruta/al/archivo}} {{[-d|--delete]}} '{{input_characters}}'

Comprime una serie de caracteres idénticos a un solo carácter:

tr <{{ruta/al/archivo}} {{[-s|--squeeze-repeats]}} '{{input_characters}}'

Traduce el contenido de un archivo a mayúsculas:

tr <{{ruta/al/archivo}} "[:lower:]" "[:upper:]"

Elimina los caracteres no imprimibles de un archivo:

tr <{{ruta/al/archivo}} {{[-cd|--complement --delete]}} "[:print:]"

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.