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 
01
02
03
> cat f1
11
12
13

> paste -d , f0 f1
01,11
02,12
03,13

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

> paste -d "\0" f0 f1
0111
0212
0313
> paste -d "\'" f0 f1
01'11
02'12
03'13

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, lam

BSD June 25, 2004