Concatenates or displays files.
cat [ - q ] [ -r ] [ - s ] [ - S ] [ - u ] [ - n [ - b ] ] [ - v [ - e ] [ - t ] ] [ - | File ... ]
The cat command reads each File parameter in sequence and writes it to standard output. If you do not specify a file name, the cat command reads from standard input. You can also specify a file name of - (dash) for standard input.
Attention: Do not redirect output to one of the input files using the redirection symbol, > (caret). If you do this, you lose the original data in the input file because the shell truncates the file before the cat command can read it. See "Redirecting Input and Output in the Korn Shell" in AIX 5L Version 5.1 System User's Guide: Operating System and Devices for more information.
-b | Omits line numbers from blank lines, when specified with the -n flag. |
-e | Displays a $ (dollar sign) at the end of each line, when specified with the -v flag. |
-n | Displays output lines preceded by line numbers, numbered sequentially from 1. |
-q | Does not display a message if the cat command cannot find an input file. This flag is identical to the -s flag. |
-r | Replaces multiple consecutive empty lines with one empty line. This flag is identical to the -S flag. |
-s | Does not display a message if the cat command cannot find an
input file. This flag is identical to the -q flag.
Note: Previously, the -s flag handled tasks now assigned to the -S flag. |
-S | Replaces multiple consecutive empty lines with one empty line. This flag is identical to the -r flag. |
-t | Displays tab characters as ^I if specified with the -v flag. |
-u | Does not buffer output. The default is buffered output. |
-v |
Displays nonprinting characters as visible characters, with the exception of tabs, new-lines, and form-feeds. ASCII control characters (octal 000-037) are printed as ^n, where n is the corresponding ASCII character in the octal range 100-137 (@, A, B, C,..., X, Y, Z, [, \, ], ^, and _); the DEL character (octal 0177) is printed as ^?. Other non-printable characters are printed as M-x, where x is the ASCII character specified by the low-order seven bits. When used with the -v option, the following options may be used:
The -e and -t options are ignored if the -v option is not specified.
|
- | Allows standard input to the cat command. |
This command returns the following
exit values:
0 | All input files were output successfully. |
>0 | An error occurred. |
Attention: Do not redirect output to one of the input files using the redirection symbol, > (caret).
cat notes
This command displays the data in the notes file. If the file is more than one less than the number of available display lines, some of the file scrolls off the screen. To list a file one page at a time, use the pg command.
cat section1.1 section1.2 section1.3 >section1
This command creates a file named section1 that is a copy of section1.1 followed by section1.2 and section1.3.
cat: cannot open section2.1
You may want to suppress this message with the -q flag when you use the cat command in shell procedures.
cat section1.4 > > section1
The > > (two carets) appends a copy of section1.4 to the end of section1. If you want to replace the file, use the > (caret).
cat >>notes Get milk on the way home Ctrl-D
This command adds Get milk on the way home to the end of the file called notes. The cat command does not prompt; it waits for you to enter text. Press the Ctrl-D key sequence to indicate you are finished.
cat section3.1 - section3.3 >section3
This command concatenates section3.1, text from the keyboard (indicated by the minus sign), and section3.3.
/usr/bin/cat | Contains the cat command. |
The cp command, ksh command, pcat command, pg command, pr command.
Files Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
File Systems and Directories Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
The Input and Output Redirection Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
Redirecting Input and Output in the Korn Shell in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
Shells Overview in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
File and Directory Access Modes in AIX 5L Version 5.1 System User's Guide: Operating System and Devices.