Skip to main content

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

OptionDescription
-d, --delimiters=LISTReuse characters from LIST instead of TABs.
-s, --serialPaste one file at a time instead of in parallel.

Real-world Examples

  1. Merge two files side-by-side:

    paste names.txt numbers.txt
  2. Merge files using a comma delimiter:

    paste -d ',' names.txt numbers.txt
  3. Merge all lines of a file into a single line:

    paste -s -d ' ' lines.txt