Translate Characters: tr



next up previous contents index
Next: Smart File Splitters: Up: Unix Toolkit Previous: Unix Toolkit

Translate Characters: tr

The tr command translates one group of characters into another set. This is often used to change uppercase to lowercase or vice versa. The command does not accept a file name so its input must be through the standard input. For example, to convert the capital characters 'A' through 'Z' in file upper.f into 'a' through 'z' in file lower.f:
   

% tr '[A-Z]' '[a-z]' < upper.f > lower.f   	   
% tr -s " " " " < paper.tex   	Remove multiple blank spaces.   

In the second command we used the -s option to squeeze multiple occurrences of a character (in this case blanks) into a single occurrence of that character.



next up previous contents index
Next: Smart File Splitters: Up: Unix Toolkit Previous: Unix Toolkit