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 | |
bf40f8ff | 18 | .Op Ar |
b5dc1377 | 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: |
bf40f8ff CL |
29 | .Bl -tag -width Ds |
30 | .It Fl b | |
49c5b53c | 31 | Implies the |
b5dc1377 | 32 | .Fl n |
49c5b53c | 33 | option but doesn't number blank lines. |
bf40f8ff | 34 | .It Fl e |
49c5b53c | 35 | Implies the |
b5dc1377 | 36 | .Fl v |
bf40f8ff CL |
37 | option, and displays a dollar sign |
38 | .Pq Ql \&$ | |
39 | at the end of each line | |
49c5b53c | 40 | as well. |
bf40f8ff | 41 | .It Fl n |
49c5b53c | 42 | Number the |
b5dc1377 | 43 | .Ar output |
49c5b53c | 44 | lines, starting at 1. |
bf40f8ff | 45 | .It Fl s |
49c5b53c KB |
46 | Squeeze multiple adjacent empty lines, causing the output to be |
47 | single spaced. | |
bf40f8ff | 48 | .It Fl t |
49c5b53c | 49 | Implies the |
b5dc1377 | 50 | .Fl v |
bf40f8ff CL |
51 | option, and displays tab characters as |
52 | .Pq Ql ^I | |
53 | as well. | |
54 | .It Fl u | |
334f3902 | 55 | The |
5325ced3 CL |
56 | .Fl u |
57 | option guarantees that the output is unbuffered. | |
bf40f8ff | 58 | .It Fl v |
49c5b53c | 59 | Displays non-printing characters so they are visible. |
bf40f8ff CL |
60 | Control characters print line |
61 | .Ql ^X | |
62 | for control-X; the delete | |
63 | character (octal 0177) prints as | |
64 | .Ql ^? | |
49c5b53c | 65 | Non-ascii characters (with the high bit set) are printed as |
bf40f8ff CL |
66 | .Ql M- |
67 | (for meta) followed by the character for the low 7 bits. | |
68 | .El | |
b5dc1377 | 69 | .Pp |
5325ced3 | 70 | .Nm Cat |
b5dc1377 CL |
71 | is useful for getting files into a pipe, for instance, to sort |
72 | two files together, | |
73 | the command | |
74 | .Pp | |
75 | .Dl cat file1 file2 | sort > sfile | |
76 | .Pp | |
77 | reads the contents of | |
78 | file1 and file2 sequentially, pipes it all to sort and places the | |
79 | newly sorted data in file3. | |
80 | .Pp | |
ea642694 | 81 | Because of the shell language mechanism used to perform output |
bf40f8ff CL |
82 | redirection, the command |
83 | .Dq Li cat file1 file 2 > file1 | |
84 | will cause | |
85 | original data in file1 to be destroyed! | |
b5dc1377 | 86 | .Pp |
bf40f8ff CL |
87 | .Nm Cat |
88 | The cat utility exits 0 on success, and >0 if an error | |
b5dc1377 CL |
89 | occurs. |
90 | .Sh SEE ALSO | |
91 | .Xr head 1 , | |
92 | .Xr more 1 , | |
93 | .Xr pr 1 , | |
94 | .Xr tail 1 | |
bf40f8ff CL |
95 | .Rs |
96 | .%A Rob Pike | |
97 | .%T "UNIX Style, or cat -v Considered Harmful" | |
98 | .%J "USENIX Summer Conference Proceedings" | |
99 | .%D 1983 | |
100 | .Re | |
b5dc1377 | 101 | .Sh HISTORY |
bf40f8ff | 102 | A |
b5dc1377 | 103 | .Nm |
bf40f8ff | 104 | command appeared in Version 6 AT&T UNIX. |