paste(1)paste(1)Namepaste - merge file data
Syntaxpaste file1 file2...
paste-dlist file1 file2...
paste-s [-dlist] file1 file2...
Description
In the first two forms, concatenates corresponding lines of the given
input files file1, file2, etc. It treats each file as a column or col‐
umns of a table and pastes them together horizontally (parallel merg‐
ing).
In the last form, the command combines subsequent lines of the input
file (serial merging).
In all cases, lines are glued together with the tab character, or with
characters from an optionally specified list. Output is to the stan‐
dard output, so it can be used as the start of a pipe, or as a filter,
if - is used in place of a file name.
Options
- Used in place of any file name, to read a line from the stan‐
dard input. (There is no prompting).
-dlist Replaces characters of all but last file with nontabs charac‐
ters (default tab). One or more characters immediately follow‐
ing -d replace the default tab as the line concatenation char‐
acter. The list is used circularly, i. e. when exhausted, it
is reused. In parallel merging (i. e. no -s option), the lines
from the last file are always terminated with a new-line char‐
acter, not from the list. The list may contain the special
escape sequences: \n (new-line), \t (tab), \\ (backslash), and
\0 (empty string, not a null character). Quoting may be neces‐
sary, if characters have special meaning to the shell (for
example, to get one backslash, use -d"\\\\" ).
Without this option, the new-line characters of each but the
last file (or last line in case of the -s option) are replaced
by a tab character. This option allows replacing the tab char‐
acter by one or more alternate characters (see below).
-s Merges subsequent lines rather than one from each input file.
Use tab for concatenation, unless a list is specified with -d
option. Regardless of the list, the very last character of the
file is forced to be a new-line.
Examples
ls ⎪ paste -d" " -
list directory in one column
ls ⎪ paste - - - -
list directory in four columns
paste-s -d"\t\n" file
combine pairs of lines into lines
Diagnostics
line too long
Output lines are restricted to 511 characters.
too many files
Except for -s option, no more than 12 input files may be
specified.
See Alsocut(1), grep(1), pr(1)paste(1)