Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Apropos / Subsearch:
optional field

cat(1)								       cat(1)


  cat -	Concatenates or	displays files


  cat [-benrstuv] file... | -

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


  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  cat: XCU5.0

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.


  -b  [Tru64 UNIX]  Omits line numbers from blank lines	when -n	is specified.
      If you specify the -b option, the	-n option is automatically invoked
      with it.

  -e  [Tru64 UNIX]  Same as the	-v option with a $ (dollar sign) character
      displayed	at the end of each line.

  -n  [Tru64 UNIX]  Displays output lines preceded by line numbers, numbered
      sequentially from	1.

  -r  [Tru64 UNIX]  Replaces multiple consecutive empty	lines with one empty
      line, so that there is never more	than one empty line between lines
      containing characters.

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

  -t  [Tru64 UNIX]  Same as the	-v option, with	the tab	character printed as
      <&lt;Ctrl-i>&gt; (^I).

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

  -v  [Tru64 UNIX]  Displays nonprinting characters so that they are visible.


      The name of the file to be displayed.

      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.


  [Tru64 UNIX]	The cat	command	is frequently used with	>&gt; (redirection sym-
  bol) to concatenate the specified files and write them to the	specified
  destination.	(See CAUTIONS.)	The cat	command	is also	used with >&gt;>&gt; to
  append a file	to another file.


  Do not redirect output to one	of the input files using the >&gt; (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


  The following	exit values are	returned:

  0   Successful completion.

  >&gt;0  An error occurred.


   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 >&gt; 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 >&gt; 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 option, except that cat displays the error message:
	    cat: cannot	open section2.1

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

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

       The >&gt;>&gt; 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 >&gt;

   5.  To add text to the end of a file, enter:
	    cat	>&gt;>&gt; 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 (<&lt;Ctrl-d>&gt; above)	to
       indicate	you are	finished.

   6.  To concatenate several files with text entered from the keyboard,
	    cat	section3.1 - section3.3	>&gt; 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	- >&gt; 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 >&gt; file1

       If standard input is a regular file, however, the preceding command is
       equivalent to the following:
	    cat	start -	middle /dev/null end >&gt; 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.


  The following	environment variables affect the execution of cat:

      Provides a default value for the internationalization variables that
      are unset	or null. If LANG is unset or null, the corresponding value
      from the default locale is used.	If any of the internationalization
      variables	contain	an invalid setting, the	utility	behaves	as if none of
      the variables had	been defined.

      If set to	a non-empty string value, overrides the	values of all the
      other internationalization variables.

      Determines the locale for	the interpretation of sequences	of bytes of
      text data	as characters (for example, single-byte	as opposed to multi-
      byte characters in arguments).

      Determines the locale for	the format and contents	of diagnostic mes-
      sages written to standard	error.

      Determines the location of message catalogues for	the processing of


  Commands:  more(1), ksh(1), pack(1), pg(1), pr(1), Bourne shell sh(1b),
  POSIX	shell sh(1p)

  Standards:  standards(5)