merge same lines of several files or subsequent lines of one file
paste file1 file2 . . .
paste -dlist file1 file2 . . .
paste -s [-dlist] file1 . . .
In the first two forms,
concatenates corresponding lines of the given input
and so on.
It treats each file as a column or columns
of a table and pastes them together horizontally
If you will, it is
the counterpart of
which concatenates vertically, that is,
one file after the other.
In the last form above,
replaces the function of an older command with the same name
by combining subsequent lines of the input file (serial merging).
If more than one file is specified with the -s option,
concatenates the merged files one below the other.
In all cases,
lines are glued together with the
or with characters from an optionally specified
Output is to the standard 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.
paste processes supplementary code set characters
in files, and recognizes supplementary code set
characters in the list given to the -d option (see below)
according to the locale specified in the LC_CTYPE
environment variable [see LANG on
A ``-'' may be used in place of any file name
to read a line from the standard input.
(There is no prompting.)
The meanings of the options are:
Without this option,
the new-line characters of each but the last file
(or last line in case of the
This option allows replacing the
character by one or more alternate characters (see below).
One or more characters immediately following
replace the default
as the line concatenation character.
The list is used sequentially and circularly: first, the first element on the
list is used to concatenate the lines, then the next, and so on; when all
elements have been used, the list is reused starting from the first element.
In parallel merging (that is, no -s option),
the lines from the last file are always terminated with a new-line character,
not from the
The list may contain the special escape sequences:
(empty string, not a null character).
Quoting may be necessary, if characters have special meaning to the shell
(for example, to get one backslash, use
list may contain supplementary code set characters.
Merge subsequent lines rather than one from each input file.
for concatenation, unless a
Regardless of the
the very last character of the file is forced to be a new-line.
ls | paste -d
List directory in one column
ls | paste - - - -
List directory in four columns
paste -d\t\n file1 file2
List file1 in column 1 and file2 in column 2.
Separate the columns by a tab.
paste -s -d\t\n file1 file2
Merge pairs of subsequent lines first in file1, then in file2.
Concatenate the merged file2 below file1.
language-specific message file (see LANG on
UX:paste: ERROR: too many files
option, no more than 12 input files may be specified.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004