10.0;tlc (transliterate_characters), revision 1.0, 88/01/21
tlc (transliterate_characters) -- Replace characters.
usage: tlc from_chars [to_chars]
DESCRIPTION
tlc copies standard input to standard output, substituting or deleting
selected characters. Each input character found in from-chars is
replaced by the corresponding character of to-chars.
tlc differs from chpat (change_pattern) in that it deals only with single
characters or ranges of characters, whereas chpat deals with character
strings. For example,
$ tlc xy yx
changes all x's into y's and all y's into x's, whereas
$ chpat xy yx
changes all the patterns xy into yx.
ARGUMENTS
from-chars (required)
Specify existing character(s) to be replaced. You may
specify a range of characters by separating the extremes
with a dash. For example, a-z stands for the list of
lowercase letters. from-chars may contain a maximum of
100 characters.
to-chars (optional)
Specify replacement characters. You may specify a range of
characters by separating the extremes with a dash. For
example, a-z stands for the list of lowercase letters.
to-chars may contain a maximum of 100 characters.
If from-chars and to-chars contain an equal number of
characters, tlc translates the first character in from-
chars to the first character in to-chars, and so forth.
If from-chars contains more characters than to-chars, tlc
repeats the last character in to-chars until to-chars is
as long as from-chars. However, in the output, adjacent
repetitions of the last character appear as one character.
(See example 2 below.)
If to-chars contains more characters than from-chars, the
extra characters are ignored.
Default if omitted:
delete all occurrences of characters in the
from-chars list
EXAMPLES
The following examples show tlc's operation using standard input and
output. The first line following the command line is an echo of standard
input. The next line is the tlc results, then another line of input,
then more results, and so forth.
1.
$ tlc te zq
Now is the time
Now is zhq zimq
*** EOF ***
$
2.
$ tlc abc zq
Now is the time for all good men and boys to come to the aid
Now is the time for zll good men znd qoys to qome to the zid
abcaccbaa
zqzqzz
aaaaa
zzzzz
bbbbb
q
ccccc
q
*** EOF ***
Note that multiple occurrences of a are replaced by z one for one, but
multiple occurrences of b and c are replaced with a single q, since
the from-char list is longer than the to-char list.
3.
$ tlc A-Z a-z <mary.caps >mary.lc
This command changes all uppercase letters in the input file mary.caps
to lowercase and writes the results to the file mary.lc. Lowercase
characters already in mary.caps remain unchanged.