paste(1)
NAME
paste − merge same lines of several files or subsequent lines of one file
SYNOPSIS
paste file1 file2
paste −d list file1 file2
paste −s [−d list] 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 in a table and pastes them together horizontally (parallel merging). In other words, it is the horizontal counterpart of cat(1) which concatenates vertically, i.e., one file after the other. In the −s option 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 standard output, so paste can be used as the start of a pipe, or as a filter if − is used instead of a file name.
Options are:
−d Without this option, the new-line characters of all 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 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, i.e., when exhausted, it is reused. 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 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 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 −d option. Regardless of the list, the very last character of the file is forced to be a new-line.
− Can be used in place of any file name to read a line from the standard input. (There is no prompting).
EXTERNAL INFLUENCES
International Code Set Support
Single-byte character code sets are supported.
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
SEE ALSO
NOTES
pr −t −m... works similarly, but creates extra blanks, tabs and new-lines for a nice page layout.
DIAGNOSTICS
line too long Output lines are restricted to 1023 characters.
too many files Except for −s option, no more than OPEN_MAX minus 3 input files can be specified (see limits(5)).
STANDARDS CONFORMANCE
paste: SVID2, XPG2, XPG3, proposed POSIX.2 FIPS (June 1990)
Hewlett-Packard Company — HP-UX Release 8.05: June 1991