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