pastehorizontally concatenate lines |
Command |
paste [-s] [-d
list] file ...
paste concatenates lines of all the specified input files
onto the standard output. If you specify - instead of a file,
paste uses the standard input. Normally, an output line
consists of the corresponding lines from all the input files.
paste replaces the newline character at the end of each
input line (except the one from the last file on the command line) with a tab
character, or characters specified by the -d option.
-d listspecifies a list of characters to be used one at a time instead of the
tab character to replace the newline at the end of input lines.
paste uses list circularly; when it exhausts
the characters in list, it returns to the first character in the
list. If you also specify the -s option,
paste returns to the first character of list
after processing each file. Otherwise, it returns to the first character
after each line of output. list may contain any of the following
standard C escapes such as \n, \t,
\r, \b, \\, and \0,
where \0 indicates that no separator is to be used.
-sconcatenates all lines from each input file together on the single
output line. If the -s option is not specified and an
end-of-file is detected on any (but not all) of the input files,
paste behaves as though empty lines have been read
from those files.
ls | paste -s -d'\t\t\n' displays the output of
ls in three tab separated columns.
If file A contains:
and file X contains:a b c
the commandx y z
paste A X produces:
and the commanda x b y c z
paste -s A X produces:
a b c x y z
0Successful completion.
1Failure due to any of the following:
2Unknown command line option.
You specified more files than paste can handle. The
name given in the error message is the name of the first file that
paste could not open. The number of files that
paste can open depends on the number of files that
other processes have open.
cut