Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)

User Commands (c) 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 there is
never more than one empty line between lines containing characters.
-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 <Ctrl-i> (ˆ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 they are visible.
DESCRIPTION
The cat command is frequently used with > (redirection symbol) to concatenate the specified
files and write them to the specified destination. (See CAUTIONS.) cat 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 followed by sec-
tion1.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 sec-
tion2.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
527188-021 Hewlett-Packard Company 267