cat 1.3 KB

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