TR (1) CP/M Utilities TR (1) NAME NAME tr -- Character translation utility SYNOPSIS SYNOPSIS tr [-cds] infile outfile DESCRIPTION DESCRIPTION TR takes input and, based on command strings, translates characters in that input to produce its output. There are two command strings: an "old character" string and a "new character" string (input of strings is at a prompt). All characters from standard input that match a character in the "old" command string will be translated to the corresponding character in the "new" string. Hence, with an "old" string of "i" and a "new" string of "A", all lowercase a's in the input will be changed to uppercase in the output. All other characters are unchanged. There are three special forms used in the command strings: [a-b] = Range of characters from a to b 'a' = Literal character a '\x' = Literal hexadecimal character x In ranges, a must be less than b, and either a or b may be literals. Only one literal character may be enclosed between single quotes. A command string may be any combination of the above forms. The -d ("delete") option takes only one command string, with all characters in that string being deleted from the input. The -s ("squeeze") option also takes only one command string, with multiple occurrances of the characters being collapsed into a single occurrance. The -c ("complement") option may be given only with the -d option. It indicates that all characters NOT in the string are to be deleted. EXAMPLES EXAMPLES The following are examples of command strings and their effects. old: [a-z] new: [A-Z] (Maps lower- to upper-case) old: ['\81'-'\fe'] new: ['\01'-'\7e'] (Strips parity bits) '\0a' (with -s option) (Eliminates blank lines) [0-9]'\0a'' ' (with -cd options) (removes all chars except digits, newlines, and spaces) -1- TR (1) CP/M Utilities TR (1) NOTES NOTES Literals should be used to generate control characters, spaces, square brackets, and single quotes. BUGS BUGS Input of command strings must be from console (unfortunately), instead of as arguments (as in UNIX), since CP/M-80 folds everything to upper-case. The NUL character (00H) cannot be used in a command string. Any attempt to do so will generate an error message to that effect. -2-