paste [-s] [-d list] file file [ - ]...

Concatenate the corresponding lines of the files (one from each)
replacing newline characters with a single delimter (except the last file's ).

If the end of a file is reached while other files still contain data, empty lines are supplied.

-s Serially concatenate all lines of each file before proceding to the next file (in command line order).
The newlines are replaced with the delimiter (except the last line) .

-d list of delimiter characters to replace the newlines.
The characters in list are used circularly, i.e., after the last character in list is used, the first character is used.
This continues until a line from the last input file
(in default operation) or the last line in each file (-s)
is processed, then characters are selected from the beginning of list again.

The default delimeter is \t tab
\0 No delimiter is inserted (not a null character)

To use STDIN specify - as one of the files ; standard input is read one line at a time, circularly, for each instance of - .

> cat f0 
> cat f1

> paste -d , f0 f1

> paste -s f0 f1
01 [tab] 02 [tab] 03
11 [tab] 12 [tab] 13

> paste -d "\0" f0 f1
> paste -d "\'" f0 f1

Combine pairs of lines from a file into single lines:

paste -s -d '\t\n' myfile

Number the lines in a file, similar to nl(1):

sed = myfile | paste -s -d '\t\n' - -

Create a colon-separated list of directories named bin, suitable for use in the PATH environment variable:

find / -name bin -type d | paste -s -d : -

See cut


laminate files

lam [-f [0|-] min.max] [-s sepstring] [-t c] file
lam [-p [0|-] min.max] [-s sepstring] [-t c] file

copies files side by side onto the standard output. The n-th input lines from the input files are considered fragments of the single long n-th output line into which they are assembled.
If file specifies `-' the standard input, and may be repeated.

Each option affects only the file after it.
If the option letter is capitalized it affects all subsequent files until it appears again uncapitalized.

-f [0|-] min.max] min.max field widths.
0 zero fill.
- left-justified
-p [0|-] min.max] pad this file's field when end-of-file is reached and other files are still active.
-s sepstring Output sepstring before outputing line fragments from the next file.
May appear after the last file.
-t c The input line terminator is c instead of a newline. The newline normally appended to each output line is omitted.

To output files simultaneously for easy viewing use pr(1).


join 4 files together along each line.
lam file1 file2 file3 file4

To merge the lines from four different files use
lam file1 -S "\
" file2 file3 file4

Every 2 lines of a file may be joined on one line
lam - - < file

a form letter with substitutions keyed by `@'
lam -t @ letter changes


join(1), paste(1), pr(1), printf(3)

Some of the functionality of lam is standardized as the paste(1) utility