examples of tr

kemp at noscvax.UUCP kemp at noscvax.UUCP
Fri Apr 20 00:27:31 AEST 1984


-a non-blank line-

  Here are three examples of using tr on a 4.2bsd system.
    Does anyone have comments?

 % tr -cs A-Za-z '\012' <file1 >file2
  creates a list of all the words in `file1' one per line in `file2',
  where a word is taken to be a maximal string of alphabetics.
  the second string is quoted to protect `\' from the shell.
  012 is the ascii code (in octal) for newline.

 % tr A-Z a-z
  will translate all upper case characters into lower case.

 % tr -d '\015' < in > out
  will read from file 'in', deleting all ^M (carriage return) characters
  and storing the result into file 'out'. 015 is the ascii code (in octal)
  for carriage return.
             - - - - - - * - - - - - -



More information about the Comp.unix mailing list