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