paste
Linux · Text · reference only
What it does
Merges files line by line, placing each line of one file next to the line in the same position of the others.
Syntax
paste [opciones] [fichero...]
Options and parameters
-d listaUses those characters as delimiters instead of a tab.
-sJoins all the lines of each file into a single one, instead of going file by file.
-zUses the null character as the line separator.
-Reads from standard input; repeating it spreads the lines into columns.
Usage examples
paste nombres.txt edades.txtJoins each name with its age, separated by a tab.
paste -d: a.txt b.txtSame, but separated by a colon.
paste -sd, lista.txtTurns a file's lines into a single comma-separated line.
seq 6 | paste - - -Spreads the numbers 1 to 6 into two rows of three columns.
Notes and common mistakes
- If one file has fewer lines than another, the missing columns are left empty.