NAME
paste
—
merge lines
SYNOPSIS
paste |
[-z ] [-d
elimiters] [file]… |
paste |
-s [-z ]
[-d elimiters]
[file]… |
DESCRIPTION
Without -s
, concatenates consecutive lines
of files (standard input stream if
"-", the default), separating them with tabs,
until all are exhausted; otherwise concatenates each
file in turn.
OPTIONS
-s
,--serial
- Concatenate the entirety of each file in turn.
-z
,--zero-terminated
- Input and output lines are terminated by NULs, not newlines.
-d
,--delimiters
=list- A list of delimiters to use instead of the tab, used circularly for each
output line.
Each character corresponds to itself as a delimiter, except the following escapes are recognised:
Defaults to "\t". Empty list is equivalent to "\0". Characters is parsed according to the current locale; invalid multi-byte sequences are ignored.
EXIT STATUS
1 if a file couldn't be opened.
EXAMPLES
List directory in four columns:
$
ls
|
paste
- - - -
a a.c a.cpp a.out fips151-1.pdf paste paste.1 paste.cpp paste.o paste.ps
Combine pairs of lines:
$
seq
10|
paste
-sd
'\t\n'-
1 2 3 4 5 6 7 8 9 10
STANDARDS
Conforms to IEEE Std 1003.1-2008
(“POSIX.1”). -z
, allowing no
files, -d
escapes other than
\n, \t, \0,
and \\, and empty
delimiters are extensions, also present on the GNU
system.
HISTORY
Appeared, fully formed, as paste(1):
/* paste: concatenate corresponding lines of each file in parallel(GWRL) */ /* (-s option: serial concatenation like old (127's) paste command */
paste
from 127 (AT&T's Computer
Science Research division) exists in earlier systems.
It was standardised verbatim in IEEE Std 1003.2-1992 (“POSIX.2”), and appears in 4.3BSD-Reno.