Log In | Not a Member? | Support | |
SYNTAX Translate sourceString [destinationString ] [-p] [-s] DESCRIPTION The Translate tool copies standard input to standard output, translating characters specified in the source string to the corresponding characters in the destination string. In doing this, Translate observes the following rules: • Characters not in the source string are copied as is. • If you omit the destination string, all characters in the source string are deleted. • If the source string is longer than the destination string, the extra characters in the source are translated to the last character in the destination. If any of these extra source characters are adjacent to each other in the input, they are replaced with a single character--that is, the last character in the destination string. INPUT Standard input. OUTPUT Standard output. STATUS
Translate can return the following status codes:
PARAMETERS sourceString Specifies the source string, where sourceString is a string of one or more characters or a range of characters separated by a minus sign. For instance, A-Z specifies the characters A through Z. Note that these characters are not bracketed and that standard escape characters (such as ∂t, ∂n, ∂f) are processed. To specify a minus sign you place it last in the character list. In addition to specifying a list of characters to translate, you can use this parameter to translate all characters except those listed. To do this you precede the list with a ¬ character. For example, ¬0-9 indicates that you want to translate all characters except digits.
Note destinationString Specifies the destination string, where destinationString is a string of one or more characters or a range of characters separated by a minus sign. Note that these characters are not bracketed and that standard escape characters (such as ∂t, ∂n, ∂f) are processed. To specify a minus sign you place it last in the character list. OPTIONS -p Writes version information to diagnostic output. -s Sets the output's tab setting, font, and font size to that of the input. This is especially useful when used with input and output redirection. EXAMPLES The following command line converts all lowercase letters in origFile to uppercase and writes the translated file to ucFile: Translate a-z A-Z <origFile >ucFile The next command line converts each string of digits in origFile to the single digit 9 in outFile: Translate 0-9 9 <origFile >outFile To produce an output file with just one word on each line, the following command line converts each run of spaces, tabs, or newline (carriage return) characters to a single newline character. Note that the source string had to be enclosed in quotation marks to specify the space. Translate " ∂t∂n" ∂n <origFile >outFile Using the ¬ character, the following command line replaces all characters except letters and newline characters with spaces. This removes all punctuation and isolates words by spaces on each line. Translate ¬a-zA-Z∂n " " <origFile >outFile
Note
|