paste
The paste command merges lines of multiple files side-by-side, separated by tabs. It is the horizontal equivalent of the cat command which appends files vertically.
Basic Syntax
paste [OPTION]... [FILE]...
Common Options
| Option | Description |
|---|---|
-d, --delimiters=LIST | Reuse characters from LIST instead of TABs. |
-s, --serial | Paste one file at a time instead of in parallel. |
Real-world Examples
-
Merge two files side-by-side:
paste names.txt numbers.txt -
Merge files using a comma delimiter:
paste -d ',' names.txt numbers.txt -
Merge all lines of a file into a single line:
paste -s -d ' ' lines.txt