]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/cat
merge
[plan9front.git] / sys / man / 1 / cat
1 .TH CAT 1
2 .SH NAME
3 cat, read \- catenate files
4 .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 nlines
16 ] [
17 .B -c
18 .I nbytes
19 ] [
20 .I file ...
21 ]
22 .SH DESCRIPTION
23 .I Cat
24 reads each
25 .I file
26 in sequence and writes it on the standard output.
27 Thus
28 .IP
29 .L
30 cat file
31 .LP
32 prints a file and
33 .IP
34 .L
35 cat file1 file2 >file3
36 .LP
37 concatenates the first two files and places the result
38 on the third.
39 .PP
40 If no
41 .I file
42 is given,
43 .I cat 
44 reads from the standard input.
45 Output is buffered in blocks matching the input.
46 .PP
47 .I Read
48 copies to standard output exactly one line from the named
49 .IR file ,
50 default standard input.
51 It is useful in interactive
52 .IR rc (1)
53 scripts.
54 .PP
55 The
56 .B -m
57 flag causes it to continue reading and writing multiple lines until end of file;
58 .B -n
59 causes it to read no more than
60 .I nlines
61 lines.
62 .PP
63 With the
64 .B -c
65 flag,
66 .I read
67 copies exactly
68 .I nbytes
69 of characters instead of lines. It is mutually exclusive with
70 .B -n
71 and
72 .B -m
73 flag.
74 .PP
75 .I Read
76 always executes a single
77 .B write
78 for each line of input, which can be helpful when
79 preparing input to programs that expect line-at-a-time data.
80 It never reads any more data from the input than it prints to the output.
81 .SH SOURCE
82 .B /sys/src/cmd/cat.c
83 .br
84 .B /sys/src/cmd/read.c
85 .SH SEE ALSO
86 .IR cp (1)
87 .SH DIAGNOSTICS
88 .I Read
89 exits with status
90 .B eof
91 on end of file or, in the
92 .B -n
93 case, if it doesn't read
94 .I nlines
95 lines.
96 .SH BUGS
97 Beware of
98 .L "cat a b >a"
99 and
100 .LR "cat a b >b" ,
101 which
102 destroy input files before reading them.