Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tr(1) — 386BSD 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

TR(1)                       386BSD Reference Manual                      TR(1)

NAME
     tr - Translate Characters.

SYNOPSIS
     tr [-c] [-d | -s] string1 string2

DESCRIPTION
     The tr utility copies the standard input to the standard output with
     substitution or deletion of selected characters.  The options specified
     and the string1 and string2 operands control translations that occur
     while copying characters.

     The following options are available:

     -c      Complements the set of characters in string1 with respect to the
             universe of characters whose ISO 646 [4] codes are 00 through
             0377 octal.

     -d      Deletes all input characters in string1.

     -s      Squeezes all output strings of one or more instances of a single
             character in string2 to a single instance of that character.
             Input characters found in string1 are mapped into the
             corresponding characters of string2. When string2 is shorter than
             string1, string2 is extended to the length of string1 by
             duplicating the last character of string2. If string2 is
             explicitly a string of zero length, string2 is padded with NUL
             characters.

     The following operands are available:

     string1

     string2  Translation character strings.

     If the -c option is given in conjunction with the -d option, then only
     those characters found in string1 is copied to the standard output.

     The following conventions can be used in string1 or string2 or both to
     specify characters, character ranges, character classes, or collating
     elements:

     character    Represents that character.

     \octal       A backslash followed by 1, 2, or 3 octal digits represents a
                  character with that encoded value.  If a \octal sequence is
                  followed by digits, the backslash and up to three digits are
                  interpreted to prepare a character; subsequent digits are
                  interpreted as individual characters.

     \character   A backslash followed by any character except an octal digit
                  represents that character.

     [c-c]        Represents the range of ordered elements between the range
                  endpoints, inclusive.

     [[:class:]]  Represents all characters belonging to the defined character
                  class.  Allowable names for class are:

                        alpha  upper  lower  digit  xdigit  alnum
                        space  punct  print  graph  cntrl



                  The characters placed in ascending order.

     [[=equiv=]]  Represents all characters or collating (sorting) elements
                  belonging to the same equivalence class as equiv.  If there
                  is a secondary ordering within the equivalence class, the
                  characters are ordered in ascending sequence.  Otherwise,
                  they are ordered after their encoded values.

     [[.cs.]]     Represents a collating symbol.  Multicharacter collating
                  symbols shall be represented as collating symbols to
                  distinguish them from a string of the same characters.

     [x*n]        Represents n repeated occurrences of the character or
                  collating symbol x.  This expression is only valid when it
                  occurs in string2. If n is omitted or is zero, it is be
                  interpreted as large enough to extend the string2-based
                  sequence to the length of the string1-based sequence.  If n
                  has a leading zero, it shall be interpreted as an octal
                  value.  Otherwise, it shall be interpreted as a decimal
                  value.

     Characters belonging to an equivalence class occupy the same position in
     the sequence, ordered after secondary ordering.

     The tr utility exits with one of the following values:

     0       All input was processed successfully.

     1       An error occurred.

STANDARDS
     The tr utility is expected to be IEEE Std1003.2 (``POSIX'') compatible.

BSD Experimental                 July 30, 1991                               2
































Typewritten Software • bear@typewritten.org • Edmonds, WA 98026