xref: /original-bsd/bin/cat/cat.1 (revision c4347674)
1.\" Copyright (c) 1989, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)cat.1	6.8 (Berkeley) 06/11/90
7.\"
8.Dd
9.Dt CAT 1
10.Os BSD 3
11.Sh NAME
12.Nm cat
13.Nd concatenate and print files
14.Sh SYNOPSIS
15.Nm cat
16.Op Fl benstuv
17.Op Fl
18.Ar
19.Sh DESCRIPTION
20The
21.Nm cat
22utility reads files sequentially, writing them to the standard output.
23The
24.Ar file
25operands are processed in command line order.
26A single dash represents standard input.
27.Pp
28The options are as follows:
29.Tp Fl b
30Implies the
31.Fl n
32option but doesn't number blank lines.
33.Tp Fl e
34Implies the
35.Fl v
36option, and displays a dollar sign (``$'') at the end of each line
37as well.
38.Tp Fl n
39Number the
40.Ar output
41lines, starting at 1.
42.Tp Fl s
43Squeeze multiple adjacent empty lines, causing the output to be
44single spaced.
45.Tp Fl t
46Implies the
47.Fl v
48option, and displays tab characters as ``^I'' as well.
49.Tp Fl u
50The
51.Fl u option guarantees that the output is unbuffered.
52.Tp Fl v
53Displays non-printing characters so they are visible.
54Control characters print line ``^X'' for control-X; the delete
55character (octal 0177) prints as ``^?''.
56Non-ascii characters (with the high bit set) are printed as
57`.`M-'' (for meta) followed by the character for the low 7 bits.
58.Tp
59.Pp
60.Nm cat
61is useful for getting files into a pipe, for instance, to sort
62two files together,
63the command
64.Pp
65.Dl cat file1 file2 | sort > sfile
66.Pp
67reads the contents of
68file1 and file2 sequentially, pipes it all to sort and places the
69newly sorted data in file3.
70.Pp
71Because of the shell language mechanism used to perform output
72redirection, the command ``cat file1 file 2 > file1'' will cause
73.P original data in file1 to be destroyed!
74.Pp
75.Nm Cat
76The cat utility exits 0 on success, and >0 if an error
77occurs.
78.Sh SEE ALSO
79.Xr head 1 ,
80.Xr more 1 ,
81.Xr pr 1 ,
82.Xr tail 1
83.Pp
84Rob Pike,
85.Em UNIX Style, or cat -v Considered Harmful
86USENIX Summer Conference Proceedings, 1983.
87.Sh HISTORY
88The
89.Nm
90command appeared in Version 7 AT&T UNIX.
91