cat 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. .I Read
  61. always executes a single
  62. .B write
  63. for each line of input, which can be helpful when
  64. preparing input to programs that expect line-at-a-time data.
  65. It never reads any more data from the input than it prints to the output.
  66. .SH SOURCE
  67. .B /sys/src/cmd/cat.c
  68. .br
  69. .B /sys/src/cmd/read.c
  70. .SH SEE ALSO
  71. .IR cp (1)
  72. .SH DIAGNOSTICS
  73. .I Read
  74. exits with status
  75. .B eof
  76. on end of file or, in the
  77. .B -n
  78. case, if it doesn't read
  79. .I nlines
  80. lines.
  81. .SH BUGS
  82. Beware of
  83. .L "cat a b >a"
  84. and
  85. .LR "cat a b >b" ,
  86. which
  87. destroy input files before reading them.