examples of cat

kemp at noscvax.UUCP kemp at noscvax.UUCP
Wed May 16 23:18:23 AEST 1984


-a non-blank line-

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

 % cat filename
  lists the entire contents of filename at the terminal.

 % cat -n filename > outfile
  copies the contents of file 'filename' into 'outfile'.
  The -n causes line numbers to appear in the output file.

 % cat file1 file2 >file3
  concatenates the first two files and places the result on the third.

  CAVEAT: Beware of 'cat a b >a' and 'cat a b >b'
  which destroy the input files BEFORE reading them.

 % cat -v printfile
  lists as above, but causes 'non-printing' characters to be listed in a
  visible way.

 % cat - x - y > z
  will A: accept input from the terminal until a ^D and store it in file "z"
       B: list the contents of file "x" and append it to file "z"
       C: accept input from the terminal until a ^D and append it to file "z"
       D: list the contents of file "y" and append it to file "z"
  The net effect is to interleave keyins and files together!
             - - - - - - * - - - - - -



More information about the Comp.unix mailing list