.TR (TRANSLATE CHARACTER)

The TRANSLATE CHARACTER format word allows you to specify the output representation of each character in the source text. For example, you could specify all exclamation points in the file appear as blanks in the output.

Format
Read syntax diagramSkip visual syntax diagram .TR sourceresult

Operands

source
is a source character. It may be a single character or a two-character hexadecimal code.
result
is the intended output representation of the source character. It may be a single character or a two-character hexadecimal code.

Usage Notes

  1. After formatting of an input source line has been completed and immediately before actual output, each character of the output line may be translated to a different output code.
  2. Because format words are only processed internally, they are never translated in the file.
  3. Translate character specifications remain in effect until explicitly respecified.
  4. A .TR format word with no operands causes the translation table to be reinitialized and all previously specified translations to be reset.
  5. The .TR format word does not cause a break. If you have a section of text that has translation characters in effect, followed by a .TR to reset the translations, the last line of the text may not yet have been printed. In this case, that last line is not translated.
Example
.tr 40 ?
This causes all blanks in the file to be typed as question marks (?) on output.