xref: /csrg-svn/bin/cat/cat.1 (revision 47400)
143082Scael.\" Copyright (c) 1989, 1990 The Regents of the University of California.
237129Sbostic.\" All rights reserved.
319079Smckusick.\"
442525Sbostic.\" %sccs.include.redist.man%
519079Smckusick.\"
6*47400Scael.\"     @(#)cat.1	6.14 (Berkeley) 03/14/91
737129Sbostic.\"
843082Scael.Dd
943082Scael.Dt CAT 1
1043082Scael.Os BSD 3
1143082Scael.Sh NAME
1243082Scael.Nm cat
1343082Scael.Nd concatenate and print files
1443082Scael.Sh SYNOPSIS
1543082Scael.Nm cat
1643082Scael.Op Fl benstuv
1743082Scael.Op Fl
18*47400Scael.Op Ar
1943082Scael.Sh DESCRIPTION
2037129SbosticThe
2143082Scael.Nm cat
2237129Sbosticutility reads files sequentially, writing them to the standard output.
2319080SmckusickThe
2443082Scael.Ar file
2537129Sbosticoperands are processed in command line order.
2637129SbosticA single dash represents standard input.
2743082Scael.Pp
2837180SbosticThe options are as follows:
29*47400Scael.Bl -tag -width Ds
30*47400Scael.It Fl b
3137180SbosticImplies the
3243082Scael.Fl n
3337180Sbosticoption but doesn't number blank lines.
34*47400Scael.It Fl e
3537180SbosticImplies the
3643082Scael.Fl v
37*47400Scaeloption, and displays a dollar sign
38*47400Scael.Pq Ql \&$
39*47400Scaelat the end of each line
4037180Sbosticas well.
41*47400Scael.It Fl n
4237180SbosticNumber the
4343082Scael.Ar output
4437180Sbosticlines, starting at 1.
45*47400Scael.It Fl s
4637180SbosticSqueeze multiple adjacent empty lines, causing the output to be
4737180Sbosticsingle spaced.
48*47400Scael.It Fl t
4937180SbosticImplies the
5043082Scael.Fl v
51*47400Scaeloption, and displays tab characters as
52*47400Scael.Pq Ql ^I
53*47400Scaelas well.
54*47400Scael.It Fl u
5519080SmckusickThe
5644952Scael.Fl u
5744952Scaeloption guarantees that the output is unbuffered.
58*47400Scael.It Fl v
5937180SbosticDisplays non-printing characters so they are visible.
60*47400ScaelControl characters print line
61*47400Scael.Ql ^X
62*47400Scaelfor control-X; the delete
63*47400Scaelcharacter (octal 0177) prints as
64*47400Scael.Ql ^?
6537180SbosticNon-ascii characters (with the high bit set) are printed as
66*47400Scael.Ql M-
67*47400Scael(for meta) followed by the character for the low 7 bits.
68*47400Scael.El
6943082Scael.Pp
7044952Scael.Nm Cat
7143082Scaelis useful for getting files into a pipe, for instance, to sort
7243082Scaeltwo files together,
7343082Scaelthe command
7443082Scael.Pp
7543082Scael.Dl cat file1 file2 | sort > sfile
7643082Scael.Pp
7743082Scaelreads the contents of
7843082Scaelfile1 and file2 sequentially, pipes it all to sort and places the
7943082Scaelnewly sorted data in file3.
8043082Scael.Pp
8137129SbosticBecause of the shell language mechanism used to perform output
82*47400Scaelredirection, the command
83*47400Scael.Dq Li cat file1 file 2 > file1
84*47400Scaelwill cause
85*47400Scaeloriginal data in file1 to be destroyed!
8643082Scael.Pp
87*47400Scael.Nm Cat
88*47400ScaelThe cat utility exits 0 on success, and >0 if an error
8943082Scaeloccurs.
9043082Scael.Sh SEE ALSO
9143082Scael.Xr head 1 ,
9243082Scael.Xr more 1 ,
9343082Scael.Xr pr 1 ,
9443082Scael.Xr tail 1
95*47400Scael.Rs
96*47400Scael.%A Rob Pike
97*47400Scael.%T "UNIX Style, or cat -v Considered Harmful"
98*47400Scael.%J "USENIX Summer Conference Proceedings"
99*47400Scael.%D 1983
100*47400Scael.Re
10143082Scael.Sh HISTORY
102*47400ScaelA
10343082Scael.Nm
104*47400Scaelcommand appeared in Version 6 AT&T UNIX.
105