paste(1) CLIX paste(1)
NAME
paste - Merges same lines of several files, subsequent lines of one file
SYNOPSIS
paste file1 file2 ...
paste -d list file1 file2 ...
paste -s [-d list] file1 file2 ...
FLAGS
-d Without this flag, the newline characters of all but the last file
(OR last line in case of the -s flag) are replaced by a tab
character. This flag allows replacing the tab character by one or
more alternate characters (see below).
list One or more characters immediately following -d replace the default
tab as the line concatenation character. The list is used
circularly, that is, when exhausted, it is reused. In parallel
merging (in other words, no -s flag), the lines from the last file
are always terminated with a newline character, not from the list.
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 (for example, to get one backslash, use -d\\\\).
-s Merge subsequent lines rather than one from each input file. Use
tab for concatenation, unless a list is specified with a -d flag.
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 stdin.
(There is no prompting).
DESCRIPTION
In the first two forms shown in SYNOPSIS, paste concatenates corresponding
lines of the given input files file1, file2, and so on. 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 which concatenates vertically, that is, one file after the other. In
the last form shown in SYNOPSIS 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 stdout, so it can be used as the start of a pipe, or as a
filter, if - is used in place of a filename.
2/94 - Intergraph Corporation 1
paste(1) CLIX paste(1)
EXAMPLES
1. To list a directory in one column:
ls | paste -d" " -
2. The following is an example of listing a directory in four columns:
ls | paste - - - -
3. The following is an example of combining 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
No more than 12 input files may be specified, except when using the
-s flag.
EXIT VALUES
The paste command does not have an explicit exit value when successful.
If unsuccessful, paste exits with a value of 2.
RELATED INFORMATION
Commands: cut(1), grep(1), pr(1)
2 Intergraph Corporation - 2/94