paste - merge lines of files
| Use Case | Command | Description |
|---|---|---|
| Merge two files line by line | paste file1 file2 | Combine corresponding lines from each file, separated by TAB |
| Merge using custom delimiter | paste -d ',' file1 file2 | Use comma instead of TAB to separate merged lines |
| Serialize file contents | paste -s file1 file2 | Paste all lines of each file into a single line |
| Handle arbitrary filenames | find . -print0 | paste -z - - | Use zeroβbyte delimiter for safe handling of special characters |
paste [OPTION]... [FILE]...
paste writes to standard output lines consisting of sequentially corresponding lines of each given file, separated by a TAB character. Standard input is used for a file name of - or if no input files are given.
An exit status of zero indicates success, and a nonzero value indicates failure.
-s, --serial β π Paste the lines of one file at a time rather than one line from each file.-d DELIM-LIST, --delimiters=DELIM-LIST β π Consecutively use the characters in DELIM-LIST instead of TAB to separate merged lines. When DELIM-LIST is exhausted, start again at its beginning.-z, --zero-terminated β π’ Delimit items with a zero byte rather than a newline (ASCII LF). Treat input as items separated by ASCII NUL and terminate output items with ASCII NUL. This option is useful with perl -0, find -print0, and xargs -0.Take lines sequentially from each file:
$ paste num2 let3
1 a
2 b
c
Duplicate lines from a file:
$ paste num2 let3 num2
1 a 1
2 b 2
c
Intermix lines from stdin:
$ paste - let3 - < num2
1 a 2
b
c
Join consecutive lines with a space:
$ seq 4 | paste -d ' ' - -
1 2
3 4
Serial mode:
$ paste -s num2 let3
1 2
a b c
Custom delimiter:
$ paste -d '%_' num2 let3 num2
1%a_1
2%b_2
%c_
See the Common options section of the coreutils manual for shared commandβline options.
Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-31 09:44 @216.73.217.152
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format