blob: 0738206aa43a1c8f8585b65dbb148d13455dd8e0 [file] [log] [blame]
rsccfa37a72004-04-10 18:53:55 +00001.TH CAT 1
2.SH NAME
rsc058b0112005-01-03 06:40:20 +00003cat, read, nobs \- catenate files
rsccfa37a72004-04-10 18:53:55 +00004.SH SYNOPSIS
5.B cat
6[
7.I file ...
8]
9.br
10.B read
11[
12.B -m
13] [
14.B -n
15.I nline
16] [
17.I file ...
18]
rsc058b0112005-01-03 06:40:20 +000019.br
rscc8b63422005-01-13 04:49:19 +000020.B nobs
rsc058b0112005-01-03 06:40:20 +000021[
22.I file ...
23]
rsccfa37a72004-04-10 18:53:55 +000024.SH DESCRIPTION
25.I Cat
26reads each
27.I file
28in sequence and writes it on the standard output.
29Thus
30.IP
31.L
32cat file
33.LP
34prints a file and
35.IP
36.L
37cat file1 file2 >file3
38.LP
39concatenates the first two files and places the result
40on the third.
41.PP
42If no
43.I file
44is given,
45.I cat
46reads from the standard input.
47Output is buffered in blocks matching the input.
48.PP
49.I Read
50copies to standard output exactly one line from the named
51.IR file ,
52default standard input.
53It is useful in interactive
54.IR rc (1)
55scripts.
56.PP
57The
58.B -m
59flag causes it to continue reading and writing multiple lines until end of file;
60.B -n
61causes it to read no more than
62.I nline
63lines.
64.PP
rsc058b0112005-01-03 06:40:20 +000065.I Read
66always executes a single
rsccfa37a72004-04-10 18:53:55 +000067.B write
68for each line of input, which can be helpful when
69preparing input to programs that expect line-at-a-time data.
70It never reads any more data from the input than it prints to the output.
rsc058b0112005-01-03 06:40:20 +000071.PP
72.I Nobs
73copies the named files to
74standard output except that it removes all backspace
75characters and the characters that precede them.
76It is useful to use as
77.B $PAGER
78with the Unix version of
79.IR man (1)
80when run inside a
81.I win
82(see
83.IR acme (1))
84window.
rsccfa37a72004-04-10 18:53:55 +000085.SH SOURCE
rscc3674de2005-01-11 17:37:33 +000086.B \*9/src/cmd/cat.c
rsccfa37a72004-04-10 18:53:55 +000087.br
rscc3674de2005-01-11 17:37:33 +000088.B \*9/src/cmd/read.c
rsc058b0112005-01-03 06:40:20 +000089.br
rscc3674de2005-01-11 17:37:33 +000090.B \*9/bin/nobs
rsccfa37a72004-04-10 18:53:55 +000091.SH SEE ALSO
92.IR cp (1)
93.SH DIAGNOSTICS
94.I Read
95exits with status
96.B eof
97on end of file or, in the
98.B -n
99case, if it doesn't read
100.I nlines
101lines.
102.SH BUGS
103Beware of
104.L "cat a b >a"
105and
106.LR "cat a b >b" ,
107which
108destroy input files before reading them.