home *** CD-ROM | disk | FTP | other *** search
- .bp 1
- .in 0
- .he 'TR (1)'02/22/83'TR (1)'
- .fo ''-#-''
- .fi
- .in 7
- .ti -7
- NAME
- .br
- tr - character transliteration
- .sp 1
- .ti -7
- SYNOPSIS
- .br
- tr <infile [>outfile] from [to]
- .sp 1
- .ti -7
- DESCRIPTION
- .br
- "TR" copies the standard input to the standard output with
- substitution or deletion of selected characters. Input
- characters found in "FROM" are mapped into the corresponding
- characters of "TO".
- Ranges of characters may be specified by separating
- the extremes by a dash.
- For example, a-z stands for the string of characters whose ascii
- codes run from character a through character z.
-
- Strings require "escape" sequences for:
-
- .nf
- blank: \b newline: \n tab: \t
- return: \r backslash: \\ octal code: \nnn
- lower case: \l upper case: \u
- .br
- .fi
-
- These last two are necesary under CP/M because it makes
- command lines upper case before the program gets to it.
- Lower case is assumed at the beginning of both
- the <from_string> and <to_string>.
- It remains in whatever case was given last until another
- \l or \u is given OR to the end of the string.
-
- If the number of characters
- in "FROM" is the same as in "TO", a one to one corresponding
- translation will be performed on all occurrences of the characters
- in "FROM".
- If the number of characters in "FROM" is more than in "TO", the
- implication is that the last character in the "TO" string is
- to be replicated as often as necessary to make a string as long
- as the "FROM" string, and that this replicated character should
- be collapsed into only one. If the "TO" string is missing or
- empty, "TR" will take this condition as a request to delete
- all occurrences of characters in the "FROM" string.
- .sp 1
- "TR" differs from the tool "CH" since it deals only with
- single characters or ranges of characters, while "CH" deals
- with character strings. For example tr xy yx would change
- all x's into y's and all y's into x's, whereas ch xy yx
- change all the patterns "xy" into "yx".
- .sp 1
- One of the most common functions of "TR" is to translate
- upper case letters to lower case, and vice versa. Thus,
-
- .ce
- tr \ua-z a-z
-
- would map all upper case letters to lower
- case.
- .sp 1
- .ti -7
- FILES
- .br
- None
- .sp 1
- .ti -7
- SEE ALSO
- .br
- .nf
- dio
- find, ch, edit, sedit
- The "Software Tools" book, p. 51-61.
- The "UNIX Programmer's Manual", p. TR(I).
- .fi
- .sp 1
- .ti -7
- DIAGNOSTICS
- .br
- "usage: <infile [>outfile] tr from [to]"
- .br
- .in +5
- The command line passed to transit is in error.
- .br
- .in -5
- "<from> too large."
- .br
- .in +5
- The string for "from" is too large. Current limit is 129 characters
- including E0S.
- .br
- .in -5
- "<to> too large."
- .br
- .in +5
- The string for "to" is too large. Current limit is 129 characters
- including EOS.
- .sp 1
- .in -5
- .ti -7
- AUTHORS
- .br
- Original code from Kernighan and Plauger's "Software Tools",
- with minor modifications by Debbie Scherrer.
- Transliterated from RATFOR to BDS C by Robert T. Pasky.
- Calls to dio added by Edward K. Ream.
- .sp 1
- .ti -7
- BUGS/DEFICIENCIES
- .br
- None
- .sp 1
- .ti -7
- NOTES
- .br
- Link "TR" to the dio package as follows:
- .sp 1
- .ce
- clink tr -f dio
- UGS/DEFICIENCIES
- .br
- None
- .sp 1
- .ti -7
- NOTES
- .br
- Link "TR"