cat Command Purpose Concatenates or displays files. Syntax cat [ - q ] [ - s ] [ - S ] [ - u ] [ - n [ - b ] ] [ - v [ - [ - t ] ] [ - | File ... ] Description 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 - (minus) for standard input. Warning: Do not redirect output to one of the input files using the > (redirection) symbol. If you do this, you lose the origi- nal 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 Version 3.2 System User's Guide: Base and Devices for more information. Flags -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. -s Does not display a message if the cat command cannot find an input file. Note: Previously, the -s flag handled tasks now assigned to the -S flag. -S Replaces multiple consecutive empty lines with one empty line. -t Displays tab characters as \^I if specified with the -v flag. -u Does not buffer output. -v Displays nonprinting characters as visible characters. - Allows standard input to the cat command. Exit Status This command returns the following exit values: 0 All input files were output successfully. >0 An error occurred. Examples Warning: Do not redirect output to one of the input files using the > (redirection) symbol. 1. To display a file at the workstation, enter: cat notes This displays the data in the notes file. If the file is more than one less than the number of available display lines, some of it scrolls off the screen. To list a file one page at a time, use the pg 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 section1.2 and section1.3. 3. To suppress error messages about files that do not exist, enter: cat -q section2.1 section2.2 section2.3 >section2 If section2.1 does not exist, this concatenates section2.2 and section2.3. The result is the same if you do not use the -q flag, except that the cat command displays the error message: 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. 4. To append one file to the end of another, enter: cat section1.4 >>section1 The >> appends a copy of section1.4 to the end of section1. If you want to replace the file, use the >. 5. To add text to the end of a file, enter: cat >>notes Get milk on the way home Ctrl-D Get milk on the way home is added 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. 6. To concatenate several files with text entered from the key- board, enter: cat section3.1 - section3.3 >section3 This concatenates section3.1, text from the keyboard (indicated by the minus sign), and section3.3. 7. To concatenate several files with output from another command, enter: li | cat section4.1 - >section4 This copies section4.1, and then the output of the li command to the section4 file. Implementation Specifics This command is part of Base Operating System (BOS) Runtime. Files /usr/bin/cat Contains the cat command. Related Information Files Overview in AIX Version 3.2 System User's Guide: Base and Devices. File Systems and Directories Overview in AIX Version 3.2 System User's Guide: Base and Devices. Shells Overview in AIX Version 3.2 System User's Guide: Base and Devices. Redirecting Input and Output in the Korn Shell in AIX Version 3.2 System User's Guide: Base and Devices. The Input and Output Redirection Overview in AIX Version 3.2 System User's Guide: Base and Devices. Understanding File and Directory Access Modes in AIX Version 3.2 System User's Guide: Base and Devices. The cp command, ksh command, pcat command, pg command, pr command. ================================================================= ================================================================= cat Subcommand for the xgmon Command Purpose Concatenates the contents of a set of text files and writes the result to the output device of a virtual G machine (VGM). Syntax cat FileName ... Description The cat library command concatenates the contents of text files specified by the FileName parameter. It then writes the result to the output device of the virtual G machine that runs the li- brary command. If xgmon is running under X11, this output device is a graphics window that is associated with that VGM. If xgmon is running in the ASCII mode, this output device is the standard output. However, because the output of a virtual G machine can be redirected, the result of the cat library command may be placed in a file. Implementation Specifics This library command is part of Simple Network Management Proto- col Manager in Network Management. Related Information List of Network Manager Commands in AIX Version 3.2 System Management Guide: Communications and Networks. Creating xgmon Library Commands, Understanding the xgmon Pro- gramming Utility in AIX Version 3.2 Communication Programming Concepts. How to Use Library Commands, Working with the Topology Display Window, xgmon Overview for Network Managers in AIX Version 3.2 System Management Guide: Communications and Networks.