Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cat(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cp, copy

pr

sh, Rsh



CAT(1,C)                    AIX Commands Reference                     CAT(1,C)



-------------------------------------------------------------------------------
cat



PURPOSE

Concatenates or displays files.

SYNTAX


       +------------+   +------------+
cat ---|   +----+   |---|            |---|
       +---| -b |---+   +--- file ---+
         ^ | -e | |       ^        |
         | | -n | |       +--------+
         | | -q | |
         | | -s | |
         | | -t | |
         | | -u | |
         | | -v | |
         | +----+ |
         +--------+


DESCRIPTION

The cat command reads each file in sequence and writes it to standard output.
If you do not specify file or specify - (minus) instead of file, the cat
command reads from standard input.

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

FLAGS

-b      Displays output lines preceded by line numbers omitting blank lines.

-e      A "$" character is displayed at the end of each line.

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

-q      Quiet option.  Does not display a message if cat cannot find an input
        file.

-s      Squeeze option.  Removes multiple adjacent empty lines so that output
        is displayed single-spaced.




Processed November 8, 1990         CAT(1,C)                                   1





CAT(1,C)                    AIX Commands Reference                     CAT(1,C)



-t      Tab characters print as ^ I.

-u      Does not buffer output.

-v      Displays non-printing characters so that they are visible.

EXAMPLES

  1. To display a file at the work station:

      cat  notes

    This displays the file "notes".  If the file is more than about 23 lines
    long, some of it will scroll off the screen.  To display a file one page at
    a time, use the pg command.  (See "pg" for details.)

  2. To concatenate several files:

      cat  section1.1  section1.2  section1.3  >section1

    This command creates a file named "section1" that contains the file
    "section1.1" followed by files "section1.2" and "section1.3".

  3. To suppress error messages about files that do not exist:

      cat  -q  section2.1  section2.2  section2.3  >section2

    If "section2.1" does not exist, this command concatenates "section2.2" and
    "section2.3" but does not issue an error message about the non-existence of
    the file.  If you do not use the  -q flag, the command concatenates the
    files, but displays this error message:

      cat: cannot open section2.1

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

  4. To append one file to the end of another:

      cat  section1.4  >>section1

    This command uses the redirection symbol >> to append a copy of
    "section1.4" to the end of "section1".  For more on redirections, see
    "Redirection of Input and Output."

  5. To add text to the end of a file:

      cat  >>notes
      Get milk on the way home
      Ctrl-D





Processed November 8, 1990         CAT(1,C)                                   2





CAT(1,C)                    AIX Commands Reference                     CAT(1,C)



    "Get milk on the way home" is added to the end of the file "notes".  The
    cat command does not prompt; it waits for you to enter text.  Press Ctrl-D
    to indicate you are finished.

  6. To concatenate several files with text entered from the keyboard:

      cat  section3.1  -  section3.3  >section3

    This command concatenates "section3.1", text from the keyboard, and
    "section3.3".

  7. To concatenate several files with output from another command:

      li  |  cat section4.1 -  >section4

    This command copies "section4.1" and then the output of the li command to
    the file "section4".

RELATED INFORMATION

See the following commands:  "cp, copy,"  "pr," and  "sh, Rsh."


































Processed November 8, 1990         CAT(1,C)                                   3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026