maux
Star on GitHub Buy me a coffee

Manual / paste

paste(1)

PASTE(1) General Commands Manual PASTE(1)

paste - merge lines of files

paste [ -s ] [ -d list ] file

Paste merges lines from each named file. At least one file is required; a lone - in place of a file name means standard input.

Without -s, each output line is the corresponding line of every file in turn, joined by the delimiter list (see -d below) and terminated with one newline. A file that has already run out of lines contributes an empty field for the rest of the run — output continues until every file is exhausted, not merely the first one.

-s serializes instead: one output line per file, that file's own lines joined by the delimiter list. An empty file contributes no output line at all.

-d list uses the characters of list, cycling and wrapping as needed, as the join delimiter instead of the default <tab>. The cycle restarts at the first character of list at the start of every output line. The four escapes \n, \t, \\, and \0 stand for a newline, a tab, a literal backslash, and nothing at all (not a NUL byte), respectively. An empty list is an error.

/usr/man/PASTE this page

cut(1)

Exit status is 0. Without -s, every file must open before any output is produced; if one does not, a diagnostic naming it is written to standard error, nothing is written to standard output, and the exit status is 1. With -s, each file is opened and processed in turn; one that does not open is skipped with a diagnostic, the remaining operands are still processed, and the exit status is 1 if any operand failed to open. 2 for a usage error, including no file operand at all, or a malformed -d list.

A line longer than 255 bytes is truncated at that length. In the default (parallel) mode, at most 5 files may be open at once (this system's fixed 8-descriptor-per-process table, minus the standard 3); a 6th operand is refused before any file is opened.

September 14, 2026 maux