logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

paste.1p (9258B)


  1. '\" et
  2. .TH PASTE "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. paste
  12. \(em merge corresponding or subsequent lines of files
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. paste \fB[\fR-s\fB] [\fR-d \fIlist\fB] \fIfile\fR...
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR paste
  21. utility shall concatenate the corresponding lines of the given input
  22. files, and write the resulting lines to standard output.
  23. .P
  24. The default operation of
  25. .IR paste
  26. shall concatenate the corresponding lines of the input files. The
  27. <newline>
  28. of every line except the line from the last input file shall be
  29. replaced with a
  30. <tab>.
  31. .P
  32. If an end-of-file condition is detected on one or more input files, but
  33. not all input files,
  34. .IR paste
  35. shall behave as though empty lines were read from the files on which
  36. end-of-file was detected, unless the
  37. .BR \-s
  38. option is specified.
  39. .SH OPTIONS
  40. The
  41. .IR paste
  42. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  43. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  44. .P
  45. The following options shall be supported:
  46. .IP "\fB\-d\ \fIlist\fR" 10
  47. Unless a
  48. <backslash>
  49. character appears in
  50. .IR list ,
  51. each character in
  52. .IR list
  53. is an element specifying a delimiter character. If a
  54. <backslash>
  55. character appears in
  56. .IR list ,
  57. the
  58. <backslash>
  59. character and one or more characters following it are an element
  60. specifying a delimiter character as described below. These elements
  61. specify one or more delimiters to use, instead of the default
  62. <tab>,
  63. to replace the
  64. <newline>
  65. of the input lines. The elements in
  66. .IR list
  67. shall be used circularly; that is, when the list is exhausted the first
  68. element from the list is reused. When the
  69. .BR \-s
  70. option is specified:
  71. .RS 10
  72. .IP " *" 4
  73. The last
  74. <newline>
  75. in a file shall not be modified.
  76. .IP " *" 4
  77. The delimiter shall be reset to the first element of
  78. .IR list
  79. after each
  80. .IR file
  81. operand is processed.
  82. .P
  83. When the
  84. .BR \-s
  85. option is not specified:
  86. .IP " *" 4
  87. The
  88. <newline>
  89. characters in the file specified by the last
  90. .IR file
  91. operand shall not be modified.
  92. .IP " *" 4
  93. The delimiter shall be reset to the first element of list each time a
  94. line is processed from each file.
  95. .P
  96. If a
  97. <backslash>
  98. character appears in
  99. .IR list ,
  100. it and the character following it shall be used to represent the
  101. following delimiter characters:
  102. .IP "\fR\en\fR" 6
  103. <newline>.
  104. .IP "\fR\et\fR" 6
  105. <tab>.
  106. .IP "\fR\e\e\fR" 6
  107. <backslash>
  108. character.
  109. .IP "\fR\e0\fR" 6
  110. Empty string (not a null character). If
  111. .BR '\e0'
  112. is immediately followed by the character
  113. .BR 'x' ,
  114. the character
  115. .BR 'X' ,
  116. or any character defined by the
  117. .IR LC_CTYPE
  118. .BR digit
  119. keyword (see the Base Definitions volume of POSIX.1\(hy2017,
  120. .IR "Chapter 7" ", " "Locale"),
  121. the results are unspecified.
  122. .P
  123. If any other characters follow the
  124. <backslash>,
  125. the results are unspecified.
  126. .RE
  127. .IP "\fB\-s\fP" 10
  128. Concatenate all of the lines from each input file into one line of
  129. output per file, in command line order. The
  130. <newline>
  131. of every line except the last line in each input file shall be replaced
  132. with a
  133. <tab>,
  134. unless otherwise specified by the
  135. .BR \-d
  136. option. If an input file is empty, the output line corresponding to
  137. that file shall consist of only a
  138. <newline>
  139. character.
  140. .SH OPERANDS
  141. The following operand shall be supported:
  142. .IP "\fIfile\fR" 10
  143. A pathname of an input file. If
  144. .BR '\-'
  145. is specified for one or more of the
  146. .IR file s,
  147. the standard input shall be used; the standard input shall be read one
  148. line at a time, circularly, for each instance of
  149. .BR '\-' .
  150. Implementations shall support pasting of at least 12
  151. .IR file
  152. operands.
  153. .SH STDIN
  154. The standard input shall be used only if one or more
  155. .IR file
  156. operands is
  157. .BR '\-' .
  158. See the INPUT FILES section.
  159. .SH "INPUT FILES"
  160. The input files shall be text files, except that line lengths shall be
  161. unlimited.
  162. .SH "ENVIRONMENT VARIABLES"
  163. The following environment variables shall affect the execution of
  164. .IR paste :
  165. .IP "\fILANG\fP" 10
  166. Provide a default value for the internationalization variables that are
  167. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  168. .IR "Section 8.2" ", " "Internationalization Variables"
  169. the precedence of internationalization variables used to determine the
  170. values of locale categories.)
  171. .IP "\fILC_ALL\fP" 10
  172. If set to a non-empty string value, override the values of all the
  173. other internationalization variables.
  174. .IP "\fILC_CTYPE\fP" 10
  175. Determine the locale for the interpretation of sequences of bytes of
  176. text data as characters (for example, single-byte as opposed to
  177. multi-byte characters in arguments and input files).
  178. .IP "\fILC_MESSAGES\fP" 10
  179. .br
  180. Determine the locale that should be used to affect the format and
  181. contents of diagnostic messages written to standard error.
  182. .IP "\fINLSPATH\fP" 10
  183. Determine the location of message catalogs for the processing of
  184. .IR LC_MESSAGES .
  185. .SH "ASYNCHRONOUS EVENTS"
  186. Default.
  187. .SH STDOUT
  188. Concatenated lines of input files shall be separated by the
  189. <tab>
  190. (or other characters under the control of the
  191. .BR \-d
  192. option) and terminated by a
  193. <newline>.
  194. .SH STDERR
  195. The standard error shall be used only for diagnostic messages.
  196. .SH "OUTPUT FILES"
  197. None.
  198. .SH "EXTENDED DESCRIPTION"
  199. None.
  200. .SH "EXIT STATUS"
  201. The following exit values shall be returned:
  202. .IP "\00" 6
  203. Successful completion.
  204. .IP >0 6
  205. An error occurred.
  206. .SH "CONSEQUENCES OF ERRORS"
  207. If one or more input files cannot be opened when the
  208. .BR \-s
  209. option is not specified, a diagnostic message shall be written to
  210. standard error, but no output is written to standard output. If the
  211. .BR \-s
  212. option is specified, the
  213. .IR paste
  214. utility shall provide the default behavior described in
  215. .IR "Section 1.4" ", " "Utility Description Defaults".
  216. .LP
  217. .IR "The following sections are informative."
  218. .SH "APPLICATION USAGE"
  219. When the escape sequences of the
  220. .IR list
  221. option-argument are used in a shell script, they must be quoted;
  222. otherwise, the shell treats the
  223. <backslash>
  224. as a special character.
  225. .P
  226. Conforming applications should only use the specific
  227. <backslash>-escaped
  228. delimiters presented in this volume of POSIX.1\(hy2017. Historical implementations treat
  229. .BR '\ex' ,
  230. where
  231. .BR 'x'
  232. is not in this list, as
  233. .BR 'x' ,
  234. but future implementations are free to expand this list to recognize
  235. other common escapes similar to those accepted by
  236. .IR printf
  237. and other standard utilities.
  238. .P
  239. Most of the standard utilities work on text files. The
  240. .IR cut
  241. utility can be used to turn files with arbitrary line lengths into a
  242. set of text files containing the same data. The
  243. .IR paste
  244. utility can be used to create (or recreate) files with arbitrary line
  245. lengths. For example, if
  246. .IR file
  247. contains long lines:
  248. .sp
  249. .RS 4
  250. .nf
  251. cut -b 1-500 -n file > file1
  252. cut -b 501- -n file > file2
  253. .fi
  254. .P
  255. .RE
  256. .P
  257. creates
  258. .BR file1
  259. (a text file) with lines no longer than 500 bytes (plus the
  260. <newline>)
  261. and
  262. .BR file2
  263. that contains the remainder of the data from
  264. .IR file .
  265. Note that
  266. .BR file2
  267. is not a text file if there are lines in
  268. .IR file
  269. that are longer than 500 +
  270. {LINE_MAX}
  271. bytes. The original file can be recreated from
  272. .BR file1
  273. and
  274. .BR file2
  275. using the command:
  276. .sp
  277. .RS 4
  278. .nf
  279. paste -d "\e0" file1 file2 > file
  280. .fi
  281. .P
  282. .RE
  283. .P
  284. The commands:
  285. .sp
  286. .RS 4
  287. .nf
  288. paste -d "\e0" ...
  289. paste -d "" ...
  290. .fi
  291. .P
  292. .RE
  293. .P
  294. are not necessarily equivalent; the latter is not specified by this volume of POSIX.1\(hy2017
  295. and may result in an error. The construct
  296. .BR '\e0'
  297. is used to mean ``no separator'' because historical versions of
  298. .IR paste
  299. did not follow the syntax guidelines, and the command:
  300. .sp
  301. .RS 4
  302. .nf
  303. paste -d"" ...
  304. .fi
  305. .P
  306. .RE
  307. .P
  308. could not be handled properly by
  309. \fIgetopt\fR().
  310. .SH EXAMPLES
  311. .IP " 1." 4
  312. Write out a directory in four columns:
  313. .RS 4
  314. .sp
  315. .RS 4
  316. .nf
  317. ls | paste - - - -
  318. .fi
  319. .P
  320. .RE
  321. .RE
  322. .IP " 2." 4
  323. Combine pairs of lines from a file into single lines:
  324. .RS 4
  325. .sp
  326. .RS 4
  327. .nf
  328. paste -s -d "\et\en" file
  329. .fi
  330. .P
  331. .RE
  332. .RE
  333. .SH RATIONALE
  334. None.
  335. .SH "FUTURE DIRECTIONS"
  336. None.
  337. .SH "SEE ALSO"
  338. .IR "Section 1.4" ", " "Utility Description Defaults",
  339. .IR "\fIcut\fR\^",
  340. .IR "\fIgrep\fR\^",
  341. .IR "\fIpr\fR\^"
  342. .P
  343. The Base Definitions volume of POSIX.1\(hy2017,
  344. .IR "Chapter 7" ", " "Locale",
  345. .IR "Chapter 8" ", " "Environment Variables",
  346. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  347. .\"
  348. .SH COPYRIGHT
  349. Portions of this text are reprinted and reproduced in electronic form
  350. from IEEE Std 1003.1-2017, Standard for Information Technology
  351. -- Portable Operating System Interface (POSIX), The Open Group Base
  352. Specifications Issue 7, 2018 Edition,
  353. Copyright (C) 2018 by the Institute of
  354. Electrical and Electronics Engineers, Inc and The Open Group.
  355. In the event of any discrepancy between this version and the original IEEE and
  356. The Open Group Standard, the original IEEE and The Open Group Standard
  357. is the referee document. The original Standard can be obtained online at
  358. http://www.opengroup.org/unix/online.html .
  359. .PP
  360. Any typographical or formatting errors that appear
  361. in this page are most likely
  362. to have been introduced during the conversion of the source files to
  363. man page format. To report such errors, see
  364. https://www.kernel.org/doc/man-pages/reporting_bugs.html .