[net.unix] examples of cat

kemp@noscvax.UUCP (05/16/84)

-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!
             - - - - - - * - - - - - -

gwyn@brl-vgr.ARPA (Doug Gwyn ) (05/17/84)

Am not sure why you keep asking if anyone has comments, but

cat -n

and

cat -v

are options that have nothing to do with file concatenation
which is cat's r^ole in life.  They don't belong.