.PL NAME trans - translate character sequences DESCRIPTION Trans is a filter which copies the standard input to the standard output, while substituting matched incoming character sequences with assigned output sequences. The input or output character substitution sequences may be single or multiple character sequences. The following command line options are supported; -t take translation sequences from the specified file. Translation sequences are given by strings of characters separated by whitespace, in input-output pairs. Additionally, you may specify certain special (usually unprintable) characters by escape sequences. The following escape sequences are supported; \b - backspace \t - tab \f - form-feed \n - newline (linefeed) \r - carriage return \w - space character \z - no character (used in output translation) \0xnn - hex number \0nnn - octal number \mn - decimal number, where m is a non-zero digit. 1 EXAMPLE Trans may be invoked in the following manner trans x y z zzzz abc def \0x1aA ESCAPE\wA this command line will cause trans to perform the following translation on input characters each occurrence of the character x will be replaced by the character y. each occurrence of the character z will be replaced by the character string zzzz. each occurrence of the character string abc will be replaced by the character string def. each occurrence of the character string ^[A will be replaced by the string "ESCAPE A". If you have a large number of translation sequences, they may be placed in a file which will be read by trans on invocation. For example the command line; trans -t wordstar.trn < old.doc >new.doc Will translate the file old.doc to the file new.doc according to the specification provided in the file wordstar.trn. You may create a translation file with any text editor, but remember that any space (including new lines) separates input and output strings. The following is an example of a text file which is used as a translation file. AAA abc AAB hello AAC xxx a A b B c CCC Note that when a choice in string substitution exists, trans will select the first longest match. For example, if the input character stream contains the characters ....... ABCDEFG , and translation sequences existed for ABC this\wis\wABC and ABCD this\wis\wABCD and BCD this\wis\wBCD, 2 trans would make the substitution for ABCD, since it was the first and longest match. BUGS Trans does not properly handle the ascii NUL character (0) in either the input or output translation character sequences. 3