manpagez: man pages & more
info coreutils
Home | html | info | man

File: coreutils.info,  Node: tr invocation,  Next: expand invocation,  Up: Operating on characters

9.1 ‘tr’: Translate, squeeze, and/or delete characters
======================================================

Synopsis:

     tr [OPTION]... STRING1 [STRING2]

   ‘tr’ copies standard input to 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 STRING2 operands define arrays of characters ARRAY1
and ARRAY2.  By default ARRAY1 lists input characters that ‘tr’ operates
on, and ARRAY2 lists corresponding translations.  In some cases the
second operand is omitted.

   The program accepts the following options.  Also see *note Common
options::.  Options must precede operands.

‘-c’
‘-C’
‘--complement’
     Instead of ARRAY1, use its complement (all characters not specified
     by STRING1), in ascending order.  Use this option with caution in
     multibyte locales where its meaning is not always clear or
     portable; see *note Character arrays::.

‘-d’
‘--delete’
     Delete characters in ARRAY1; do not translate.

‘-s’
‘--squeeze-repeats’
     Replace each sequence of a repeated character that is listed in the
     last specified ARRAY, with a single occurrence of that character.

‘-t’
‘--truncate-set1’
     Truncate ARRAY1 to the length of ARRAY2.

   An exit status of zero indicates success, and a nonzero value
indicates failure.

* Menu:

* Character arrays::            Specifying arrays of characters.
* Translating::                 Changing characters to other characters.
* Squeezing and deleting::      Removing characters.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.