PASTE(1V)

NAME
paste - join corresponding lines of several files, or subsequent lines of one file

SYNOPSIS
paste filename1 filename2 ...
paste -dlist filename1 filename2 ...
paste -s [ -dlist ] filename

AVAILABILITY
This command is available with the System V software installation option. Refer to for information on how to install optional software.

DESCRIPTION
In the first two forms, paste concatenates corresponding lines of the given input files filename1, filename2, etc. It treats each file as a column or columns of a table and pastes them together horizontally (parallel merging). It is the counterpart of cat(1V) which concatenates vertically, that is, 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. paste can be used as a filter, if - is used in place of a filename.

OPTIONS

-d  Without this option, the NEWLINE 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 character by one or more alternate characters in list. The list is used circularly; when exhausted, it is reused. In parallel merging (no -s option), the lines from the last file are always terminated with a NEWLINE character, not from the list. 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.

-s  Merge subsequent lines rather than one from each input file. Use TAB for concatenation, unless list is specified with -d. Regardless of the list, the very last character of the file is forced to be a NEWLINE.

EXAMPLES

List directory in four columns:

    ls | paste----

Combine pairs of lines into lines:

    paste -s -d"\t\n" filename

SEE ALSO
cat(1V), cut(1V), grep(1V), pr(1V)

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.