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