'\" te .\" Copyright 1989 AT&T Copyright (c) .\" 2008, Sun Microsystems, Inc. All Rights Reserved .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. .\" This notice shall appear on any product containing this material. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH CAT 1 "Apr 8, 2008" .SH NAME cat \- concatenate and display files .SH SYNOPSIS .SS "\fB/usr/bin/cat\fR" .LP .nf \fB/usr/bin/cat\fR [\fB-nbsuvet\fR] [\fIfile\fR...] .fi .SS "\fBksh93\fR" .LP .nf \fBcat\fR [\fB-bdenstuvABDEST\fR] [\fIfile\fR...] .fi .SH DESCRIPTION .SS "\fB/usr/bin/cat\fR" .sp .LP The \fBcat\fR utility reads each \fIfile\fR in sequence and writes it on the standard output. Thus: .sp .in +2 .nf example% \fBcat file\fR .fi .in -2 .sp .sp .LP prints \fIfile\fR on your terminal, and: .sp .in +2 .nf example% \fBcat file1 file2 >file3\fR .fi .in -2 .sp .sp .LP concatenates \fIfile1\fR and \fIfile2\fR, and writes the results in \fIfile3\fR. If no input file is given, \fBcat\fR reads from the standard input file. .SS "\fBksh93\fR" .sp .LP The \fBcat\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and \fB/usr/bin\fR paths. It is invoked when \fBcat\fR is executed without a pathname prefix and the pathname search finds a \fB/bin/cat\fR or \fB/usr/bin/cat\fR executable. \fBcat\fR copies each file in sequence to the standard output. If no file is specified, or if the file is \fB-\fR, \fBcat\fR copies from standard input starting at the current location. .SH OPTIONS .SS "\fB/usr/bin/cat\fR" .sp .LP The following options are supported by \fB/usr/bin/cat\fR: .sp .ne 2 .na \fB\fB-b\fR\fR .ad .RS 6n Number the lines, as \fB-n\fR, but omit the line numbers from blank lines. .RE .sp .ne 2 .na \fB\fB-n\fR\fR .ad .RS 6n Precede each line output with its line number. .RE .sp .ne 2 .na \fB\fB-s\fR\fR .ad .RS 6n \fBcat\fR is silent about non-existent files. .RE .sp .ne 2 .na \fB\fB-u\fR\fR .ad .RS 6n The output is not buffered. .sp Buffered output is the default. .RE .sp .ne 2 .na \fB\fB-v\fR\fR .ad .RS 6n Non-printing characters, with the exception of tabs, NEWLINEs and form feeds, are printed visibly. ASCII control characters (octal \fB000\fR \(mi \fB037\fR) are printed as \fB^\fR\fIn,\fR where \fIn\fR is the corresponding ASCII character in the range octal 100 \(mi 137 (@, A, B, C, . . ., X, Y, Z, [, \e, ], ^, and _); the \fBDEL\fR character (octal \fB0177\fR) is printed \fB^?\fR. Other non-printable characters are printed as \fBM-\fR\fIx,\fR where \fIx\fR is the ASCII character specified by the low-order seven bits. .RE .sp .LP When used with the \fB-v\fR option, the following options can be used: .sp .ne 2 .na \fB\fB-e\fR\fR .ad .RS 6n A \fB$\fR character is printed at the end of each line, prior to the NEWLINE. .RE .sp .ne 2 .na \fB\fB-t\fR\fR .ad .RS 6n Tabs are printed as \fB^I\fRs and form feeds to be printed as \fB^L\fRs. .RE .sp .LP The \fB-e\fR and \fB-t\fR options are ignored if the \fB-v\fR option is not specified. .SS "\fBksh93\fR" .sp .LP \fBksh93\fR \fBcat\fR supports the following options: .sp .ne 2 .na \fB\fB-b\fR \fB--number-nonblank\fR\fR .ad .RS 25n Number lines as with \fB-n\fR but omit line numbers from blank lines. .RE .sp .ne 2 .na \fB\fB-d\fR \fB--dos-input\fR\fR .ad .RS 25n Open input files in text mode. Removes RETURNs in front of NEWLINEs on some systems. .RE .sp .ne 2 .na \fB\fB-e\fR\fR .ad .RS 25n Equivalent to \fB-vE\fR. .RE .sp .ne 2 .na \fB\fB-n\fR \fB--number\fR\fR .ad .RS 25n Insert a line number at the beginning of each line. .RE .sp .ne 2 .na \fB\fB-s\fR\fR .ad .RS 25n Equivalent to \fB-S\fR for \fBatt universe\fR and \fB-B\fR otherwise. .RE .sp .ne 2 .na \fB\fB-t\fR\fR .ad .RS 25n Equivalent to \fB-vT\fR. .RE .sp .ne 2 .na \fB\fB-u\fR \fB--unbuffer\fR\fR .ad .RS 25n Do not delay the output by buffering. .RE .sp .ne 2 .na \fB\fB-v\fR \fB--show-nonprinting\fR\fR .ad .RS 25n Cause non-printing characters (with the exception of TABs, NEWLINEs, and form feeds) to be output as printable character sequences. \fBASCII\fR control characters are printed as \fB^n\fR, where \fIn\fR is the corresponding \fBASCII\fR character in the range octal \fB100\fR-\fB137\fR. The DEL character (octal \fB0177\fR) is copied as \fB^?\fR. Other non-printable characters are copied as \fBM-\fR\fIx\fR where \fIx\fR is the \fBASCII\fR character specified by the low-order seven bits. Multi-byte characters in the current locale are treated as printable characters. .RE .sp .ne 2 .na \fB\fB-A\fR \fB--show-all\fR\fR .ad .RS 25n Equivalent to \fB-vET\fR. .RE .sp .ne 2 .na \fB\fB-B\fR \fB--squeeze-blank\fR\fR .ad .RS 25n Replace multiple adjacent NEWLINE characters with one NEWLINE. .RE .sp .ne 2 .na \fB\fB-D\fR \fB--dos-output\fR\fR .ad .RS 25n Open output files in text mode. Insert RETURNs in front of NEWLINEs on some systems. .RE .sp .ne 2 .na \fB\fB-E\fR \fB--show-ends\fR\fR .ad .RS 25n Insert a \fB$\fR before each NEWLINE. .RE .sp .ne 2 .na \fB\fB-S\fR \fB--silent\fR\fR .ad .RS 25n \fBcat\fR is silent about non-existent files. .RE .sp .ne 2 .na \fB\fB-T\fR \fB--show-blank\fR\fR .ad .RS 25n Copies TABs as \fB^I\fR and form feeds as \fB^L\fR. .RE .SH OPERANDS .sp .LP The following operand is supported: .sp .ne 2 .na \fB\fIfile\fR\fR .ad .RS 8n A path name of an input file. If no \fIfile\fR is specified, the standard input is used. If \fIfile\fR is \fB\|\(mi\|\fR, \fBcat\fR reads from the standard input at that point in the sequence. \fBcat\fR does not close and reopen standard input when it is referenced in this way, but accepts multiple occurrences of \fB\|\(mi\|\fR as \fIfile\fR. .RE .SH USAGE .sp .LP See \fBlargefile\fR(5) for the description of the behavior of \fBcat\fR when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). .SH EXAMPLES .LP \fBExample 1 \fRConcatenating a File .sp .LP The following command writes the contents of the file \fBmyfile\fR to standard output: .sp .in +2 .nf example% \fBcat myfile\fR .fi .in -2 .sp .LP \fBExample 2 \fRConcatenating Two files into One .sp .LP The following command concatenates the files \fBdoc1\fR and \fBdoc2\fR and writes the result to \fBdoc.all\fR. .sp .in +2 .nf example% \fBcat doc1 doc2 > doc.all\fR .fi .in -2 .sp .LP \fBExample 3 \fRConcatenating Two Arbitrary Pieces of Input with a Single Invocation .sp .LP When standard input is a terminal, the following command gets two arbitrary pieces of input from the terminal with a single invocation of \fBcat\fR: .sp .in +2 .nf example% \fBcat start - middle - end > file\fR .fi .in -2 .sp .sp .LP when standard input is a terminal, gets two arbitrary pieces of input from the terminal with a single invocation of \fBcat\fR. .sp .LP If standard input is a regular file, .sp .in +2 .nf example% \fBcat start - middle - end > file\fR .fi .in -2 .sp .sp .LP would be equivalent to the following command: .sp .in +2 .nf \fBcat start - middle /dev/null end > file\fR .fi .in -2 .sp .sp .LP because the entire contents of the file would be consumed by \fBcat\fR the first time \fB\|\(mi\|\fR was used as a \fIfile\fR operand and an end-of-file condition would be detected immediately when \fB\|\(mi\|\fRwas referenced the second time. .SH ENVIRONMENT VARIABLES .sp .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBcat\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .na \fB\fB0\fR\fR .ad .RS 6n All input files were output successfully. .RE .sp .ne 2 .na \fB\fB>0\fR\fR .ad .RS 6n An error occurred. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .SS "\fB/usr/bin/cat\fR" .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ Interface Stability Committed _ Standard See \fBstandards\fR(5). .TE .SS "\fBksh93\fR" .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability See below. .TE .sp .LP The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile. The built-in interfaces are Uncommitted. .SH SEE ALSO .sp .LP \fBtouch\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5) .SH NOTES .sp .LP Redirecting the output of \fBcat\fR onto one of the files being read causes the loss of the data originally in the file being read. For example, .sp .in +2 .nf example% \fBcat filename1 filename2 > filename1\fR .fi .in -2 .sp .sp .LP causes the original data in \fBfilename1\fR to be lost.