cat(1)
NAME
cat − concatenate, copy, and print files
SYNOPSIS
cat [-su] [-v [-t] [-e]] file ...
DESCRIPTION
cat reads each file in sequence and writes it on the standard output. Thus:
cat file
prints file on the default standard output device;
cat file1 file2 >file3
concatenates file1 and file2, and places the result in file3.
If - is appears as a file argument, cat uses standard input. To combine standard input and other files, use a mixture of - and file arguments.
Options
cat recognizes the following options:
-s Silent option. cat suppresses error messages about non-existent files, identical input and output, and write errors. Normally, input and output files cannot have identical names unless the file is a special file.
-u Do not buffer output (handle character-by-character). Normally, output is buffered.
-v Cause non-printing characters (with the exception of tabs, new-lines and form-feeds) to be printed visibly. Control characters are printed using the form ^X (Ctrl-X), and the DEL character (octal 0177) is printed as ^?. All other non-printing characters are printed as M-x, where x is the character specified by the seven low order bits. This option is influenced by the LANG environment variable and its corresponding code set.
When the -v option is used, the following options are also available:
-e Print a $ character at the end of each line (prior to the new-line). -v must be used with the -e option or -e is ignored.
-t Print each tab character as ^I. -v must be used with the -t option or -t is ignored.
EXTERNAL INFLUENCES
Environment Variables
LC_CTYPE determines the interpretation of text and filenames as single and/or multi-byte characters.
LANG determines the language in which messages are displayed.
If LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, cat behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
Exit values are:
0 Successful completion.
>0 Error condition occurred.
EXAMPLES
To create a zero-length file, use any of the following:
cat /dev/null >file
cp /dev/null file
touch file
SEE ALSO
cp(1), pg(1), pr(1), rmnl(1), ssp(1).
WARNINGS
Command formats such as
overwrites the data in file1 before the concatenation begins, thus destroying the file. Therefore, be careful when using shell special characters.
STANDARDS CONFORMANCE
cat: SVID2, XPG2, XPG3, POSIX.2
Hewlett-Packard Company — HP-UX Release 9.0: August 1992