cat(1)								       cat(1)



NAME
  cat - Concatenates or displays files

SYNOPSIS

  cat [-benrstuv] file ...  | -

  The cat command reads each specified file in sequence and writes it to
  standard output.

FLAGS

  -b  Omits line numbers from blank lines when -n is specified. If you
      specify the -b flag, the -n flag is automatically invoked with it.

  -e  Same as the -v flag with a $ (dollar sign) character displayed at the
      end of each line.

  -n  Displays output lines preceded by line numbers, numbered sequentially
      from 1.

  -r  Replaces multiple consecutive empty lines with one empty line, so that
      there is never more than one empty line between lines containing char-
      acters.

  -s  Does not display a message if cat cannot find an input file. (Silent
      option.)

  -t  Same as the -v flag, with the tab character printed as  (^I).

  -u  Does not buffer output. Writes bytes from the input file to standard
      output without delay as each is read.

  -v  Displays nonprinting characters so that they are visible.

DESCRIPTION

  The cat command is frequently used with > (redirection symbol) to concaten-
  ate the specified files and write them to the specified destination.	(See
  CAUTIONS.) The cat command is also used with >> to append a file to another
  file.

  If you do not specify a file or if you specify - (dash) instead of file,
  cat reads from standard input. The cat command accepts multiple occurrences
  of - (dash) as a file argument.

EXAMPLES

   1.  To display the file notes, enter:
	    cat notes


       If the file is longer than one screenful, it scrolls by too quickly to
       read.  To display a file one page at a time, use the more command.

   2.  To concatenate several files, enter:
	    cat	 section1.1  section1.2	 section1.3  > section1


       This creates a file named section1 that is a copy of section1.1 fol-
       lowed by section1.2 and section1.3.

   3.  To suppress error messages about files that do not exist, enter:
	    cat -s section2.1 section2.2 section2.3 > section2


       If section2.1 does not exist, this command concatenates section2.2 and
       section2.3.  Note that the message goes to standard error, so it does
       not appear in the output file.  The result is the same if you do not
       use the -s flag, except that cat displays the error message:
	    cat: cannot open section2.1


       You may want to suppress this message with the -s flag when you use
       the cat command in shell procedures.

   4.  To append one file to the end of another, enter:
	    cat section1.4 >> section1


       The >> in this command specifies that a copy of section1.4 be added to
       the end of section1.  If you want to replace the file, use a single >
       symbol.

   5.  To add text to the end of a file, enter:
	    cat >> notes
	    Get milk on the way home
	    


       Get milk on the way home is added to the end of notes.  With this syn-
       tax, the cat command does not display a prompt; it waits for you to
       enter text.  Press the End-of-File key sequence ( above) to
       indicate you are finished.

   6.  To concatenate several files with text entered from the keyboard,
       enter:
	    cat section3.1 - section3.3 > section3


       This concatenates section3.1, text from the keyboard, and section3.3
       to create the file section3.

   7.  To concatenate several files with output from another command, enter:
	    ls	|  cat section4.1 - > section4


       This copies section4.1, and then the output of the ls command to the
       file section4.

   8.  To get two pieces of input from the terminal (when standard input is a
       terminal) with a single command invocation, enter:
	    cat start - middle - end > file1

       If standard input is a regular file, however, the preceding command is
       equivalent to the following:
	    cat start - middle /dev/null end > file1

       This is because the entire contents of the file would be consumed by
       cat the first time it saw - (dash) as a file argument. An End-of-File
       condition would then be detected immediately when - (dash) appeared
       the second time.



CAUTIONS

  Do not redirect output to one of the input files using the > (redirection
  symbol).  If you do this, you lose the original data in the input file
  because the shell truncates it before cat can read it.  (See also the sh
  command.)

RELATED INFORMATION

  Commands:  more(1), pack(1)/pcat(1)/unpack(1), pg(1), pr(1), sh(1).