PASTE(1) SysV PASTE(1)
NAME
paste - merge same lines of several files or subsequent lines of one file
SYNOPSIS
paste file1 file2 ...
paste -dlist file1 file2 ...
paste -s [-dlist] file1 file2 ...
DESCRIPTION
In the first two forms, paste concatenates corresponding lines of the
given input files file1, file2, etc. It treats each file as a column or
columns of a table and pastes them together horizontally (parallel
merging). If you will, it is the counterpart of cat(1) which
concatenates vertically, i.e., one file after the other. In the last
form above, paste replaces the function of an older command with the same
name by combining 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 standard
output, so it can be used as the start of a pipe, or as a filter, if a
simple dash (-) is used in place of a filename.
OPTIONS
-dlist
Replace the default tab character by one or more alternate
characters, specified in list. (see below). 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 character, not from the _ist. The list
may contain the special escape sequences: \n (newline), \t (tab),
\\ (backslash), and \0 (empty string, not a null character).
Quoting may be necessary, if characters have special meaning to the
shell (e.g., to get one backslash, use -d"\\\\"
If list is not specified, the newline characters of each but the
last file (or last line in case of the -s option) are replaced with
a tab character.
NOTE: There can be no space between -d and list.
-s Merge 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 newline.
- May be used in place of any filename, to read a line from the
standard input. (There is no prompting).
EXAMPLES
To list a directory in one column:
ls | paste -d" -
To list a directory in four columns:
ls | paste - - -
To combine pairs of lines into lines:
paste -s -d"\t\n" file
DIAGNOSTICS
line too long
Output lines are restricted to 511 characters.
too many files
Except in the case of the -s option, no more than 12 input
files may be specified.
SEE ALSO
cut(1), grep(1), pr(1).