paste
Overview
paste merges lines of files side-by-side (parallel) or serially, using a delimiter (default TAB). Ideal for building TSV columns from separate lists.
Syntax
paste [options] [file...]Common Options
| Option | Description |
|---|---|
-d LIST |
Delimiter characters (cycle through LIST) |
-s |
Serial: paste one file at a time |
- |
Read stdin as a file |
Key Use Cases
- Combine columns from two files
- Build CSV/TSV quickly
- Pair names with IDs
- Join command outputs
Examples with Explanations
Side-by-side merge
paste names.txt emails.txtLine 1 of each file joined by TAB.
Comma-separated
paste -d, names.txt emails.txt > contacts.csvSimple CSV without a spreadsheet.
Number lines with nl + paste
nl -ba file.txt | headOften combined with other column tools; paste -d: <(seq 3) <(echo -e "a\nb\nc") for bash process substitution.
Serial mode
paste -s -d, file.txtJoins all lines of one file onto one line with commas.