Without command line options
paste file-1 file-2 … file-n
Without command line options, paste
will read one line from each file and write each line, without new line, but separated by a tabulator. It will do that until the all lines are read.
So, if file_one
contains
foo
bar
baz
and file_two
contains
one
two
three
then paste file_one file_two
will print
foo one
bar two
baz three
-d delimiter
-d
specifies one or more delimiters (instead of the default tabulator) with which the lines will be pasted.
paste -d, file_one file_two
will print
foo,one
bar,two
baz,three
-s don't read files in parallel
-s
can be used to create a pivot from a file.
If some.txt
contains
foo
10.3
18.9
17.1
bar
7.8
12.7
15.6
baz
11.4
15.1
16.4
then paste -d "\t\t\t\n" some.txt
will print
foo 10.3 18.9 17.1
bar 7.8 12.7 15.6
baz 11.4 15.1 16.4
Note how each delimiter is used in sequence and then «recycled».