PASTE(1P)
π PASTE(1P) π
okay bestie, pull up a chair, because this is the POSIX Programmer's Manual page for paste and she is lowkey iconic. β¨
πΈ PROLOG πΈ
so like, this manual page is part of the POSIX Programmer's Manual, okay? which means: the Linux implementation of this interface may differ (so pls go consult the corresponding Linux manual page for details on Linux behavior), or honestly the interface may not even be implemented on Linux at all. π no cap, check first.
β¨ NAME β¨
paste β merge corresponding or subsequent lines of files. yes that's it that's the whole vibe. π«Ά
π SYNOPSIS π
paste [-s] [-d list] file...
π¦ DESCRIPTION π¦
okay so here's the tea: the paste utility shall concatenate the corresponding lines of the given input files, and write the resulting lines to standard output. periodt. π
the default operation of paste shall concatenate the corresponding lines of the input files. the <newline> of every line except the line from the last input file shall be replaced with a <tab>. (that's the whole trick, bestie β tabs where the newlines used to be.)
if an end-of-file condition is detected on one or more input files, but not all input files, paste shall behave as though empty lines were read from the files on which end-of-file was detected β unless the -s option is specified. π
π OPTIONS π
the paste utility shall conform to the Base Definitions volume of POSIX.1-2017, Section 12.2, Utility Syntax Guidelines. (the rules of the game, iykyk.)
the following options shall be supported:
-d listβ unless a<backslash>character appears in list, each character in list is an element specifying a delimiter character. if a<backslash>character appears in list, the<backslash>character and one or more characters following it are an element specifying a delimiter character as described below. these elements specify one or more delimiters to use, instead of the default<tab>, to replace the<newline>of the input lines. the elements in list shall be used circularly; that is, when the list is exhausted the first element from the list is reused. when the-soption is specified:- the last
<newline>in a file shall not be modified. - the delimiter shall be reset to the first element of list after each file operand is processed.
- the last
when the -s option is not specified:
- the
<newline>characters in the file specified by the last file operand shall not be modified. - the delimiter shall be reset to the first element of list each time a line is processed from each file.
if a <backslash> character appears in list, it and the character following it shall be used to represent the following delimiter characters:
\nβ<newline>.\tβ<tab>.\\β<backslash>character.\0β empty string (not a null character). if'\0'is immediately followed by the character'x', the character'X', or any character defined by theLC_CTYPEdigit keyword (see the Base Definitions volume of POSIX.1-2017, Chapter 7, Locale), the results are unspecified. π
if any other characters follow the <backslash>, the results are unspecified. so likeβ¦ don't. π«
-sβ concatenate all of the lines from each input file into one line of output per file, in command line order. the<newline>of every line except the last line in each input file shall be replaced with a<tab>, unless otherwise specified by the-doption. if an input file is empty, the output line corresponding to that file shall consist of only a<newline>character. π
π OPERANDS π
the following operand shall be supported:
- file β a pathname of an input file. if
'-'is specified for one or more of the files, the standard input shall be used; the standard input shall be read one line at a time, circularly, for each instance of'-'. implementations shall support pasting of at least 12 file operands. twelve!! π€
π§ STDIN π§
the standard input shall be used only if one or more file operands is '-'. see the INPUT FILES section. β¬οΈ
β INPUT FILES β
the input files shall be text files, except that line lengths shall be unlimited. go as long as you want, babe. π
π ENVIRONMENT VARIABLES π
the following environment variables shall affect the execution of paste:
LANGβ provide a default value for the internationalization variables that are unset or null. (see the Base Definitions volume of POSIX.1-2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLβ if set to a non-empty string value, override the values of all the other internationalization variables.LC_CTYPEβ determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files).LC_MESSAGESβ determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.NLSPATHβ determine the location of message catalogs for the processing ofLC_MESSAGES.
πΈ ASYNCHRONOUS EVENTS πΈ
Default. (she's chill like that.)
β¨ STDOUT β¨
concatenated lines of input files shall be separated by the <tab> (or other characters under the control of the -d option) and terminated by a <newline>. chef's kiss. π©βπ³π
π STDERR π
the standard error shall be used only for diagnostic messages.
π OUTPUT FILES π
None.
π¦ EXTENDED DESCRIPTION π¦
None.
π EXIT STATUS π
the following exit values shall be returned:
0β successful completion. slay. π>0β an error occurred. π
π CONSEQUENCES OF ERRORS π
if one or more input files cannot be opened when the -s option is not specified, a diagnostic message shall be written to standard error, but no output is written to standard output. (nothing. not a crumb. πΆ)
if the -s option is specified, the paste utility shall provide the default behavior described in Section 1.4, Utility Description Defaults.
the following sections are informative. (aka: cute bonus content, not rules. π«Ά)
π§ APPLICATION USAGE π§
when the escape sequences of the list option-argument are used in a shell script, they must be quoted; otherwise, the shell treats the <backslash> as a special character. quote ur backslashes bestie, the shell is nosy. π
conforming applications should only use the specific <backslash>-escaped delimiters presented in this volume of POSIX.1-2017. historical implementations treat '\x', where 'x' is not in this list, as 'x', but future implementations are free to expand this list to recognize other common escapes similar to those accepted by printf and other standard utilities.
most of the standard utilities work on text files. the cut utility can be used to turn files with arbitrary line lengths into a set of text files containing the same data. the paste utility can be used to create (or recreate) files with arbitrary line lengths. for example, if file contains long lines:
cut -b 1-500 -n file > file1
cut -b 501- -n file > file2
creates file1 (a text file) with lines no longer than 500 bytes (plus the <newline>) and file2 that contains the remainder of the data from file. note that file2 is not a text file if there are lines in file that are longer than 500 + {LINE_MAX} bytes. the original file can be recreated from file1 and file2 using the command:
paste -d "\0" file1 file2 > file
the commands:
paste -d "\0" ...
paste -d "" ...
are not necessarily equivalent; the latter is not specified by this volume of POSIX.1-2017 and may result in an error. the construct '\0' is used to mean ``no separator'' because historical versions of paste did not follow the syntax guidelines, and the command:
paste -d"" ...
could not be handled properly by getopt(). π historic lore, honestly.
β EXAMPLES β
- write out a directory in four columns:
ls | paste - - - -
- combine pairs of lines from a file into single lines:
paste -s -d "\t\n" file
π RATIONALE π
None.
πΈ FUTURE DIRECTIONS πΈ
None.
π SEE ALSO π
Section 1.4, Utility Description Defaults, cut, grep, pr
the Base Definitions volume of POSIX.1-2017, Chapter 7, Locale, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! π₯³ this little icon dropped from IEEE/The Open Group, 2017, and it's literally labeled PASTE(1P). go forth and paste. no cap. π
β¨π¦
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms