Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tr(1) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ascii(5)

ed(1)

sh(1)






       tr(1)                                                          tr(1)


       NAME
             tr - translate characters

       SYNOPSIS
             tr [-cds] [string1 [string2]]

       DESCRIPTION
             tr copies the standard input to the standard output with
             substitution or deletion of selected characters.  Input
             characters found in string1 are mapped into the corresponding
             characters of string2.  tr processes supplementary code set
             characters according to the locale specified in the LC_CTYPE
             environment variable [see LANG on environ(5)].  Searches and
             translations are performed on characters, not bytes.

             Any combination of the options -cds may be used:

             -c      Complements the set of characters in string1 with
                     respect to the universe of characters whose codes are
                     001 through 377 octal.

             -d      Deletes all input characters in string1.

             -s      Squeezes all strings of repeated output characters
                     that are in string2 to single characters.

             The following abbreviation conventions may be used to
             introduce ranges of characters or repeated characters into the
             strings:

             [a-z]   Stands for the string of characters whose ASCII codes
                     run from character a to character z, inclusive.

             [a*n]   Stands for n repetitions of a.  If the first digit of
                     n is 0, n is considered octal; otherwise, n is taken
                     to be decimal.  A zero or missing n is taken to be
                     huge; this facility is useful for padding string2.

             The escape character \ may be used as in the shell to remove
             special meaning from any character in a string.  In addition,
             \ followed by 1, 2, or 3 octal digits stands for the character
             whose code is given by those digits.  When octal notation with
             the backslash (\) escape character is used, a backslash is
             placed before each byte of multibyte characters.




                           Copyright 1994 Novell, Inc.               Page 1













      tr(1)                                                          tr(1)


      EXAMPLES
            The following example creates a list of all the words in file1
            one per line in file2, where a word is taken to be a maximal
            string of alphabetics.  The strings are quoted to protect the
            special characters from interpretation by the shell; 012 is
            the ASCII code for newline.

                  tr -cs "[A-Z][a-z]" "[\012*]" < file1 > file2

      FILES
            /usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
                  language-specific message file [See LANG on environ
                  (5).]

      REFERENCES
            ascii(5), ed(1), sh(1)

      NOTICES
            tr will not handle ASCII NUL in string1 or string2; it always
            deletes NUL from input.




























                          Copyright 1994 Novell, Inc.               Page 2








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