LinuxCommandLibrary

paste

TLDR

Merge files side by side

$ paste [file1.txt] [file2.txt]
copy
Merge with custom delimiter
$ paste -d "," [file1.txt] [file2.txt]
copy
Merge lines from single file
$ paste -s [file.txt]
copy
Create tab-separated columns
$ paste - - < [file.txt]
copy
Merge multiple files
$ paste [file1] [file2] [file3]
copy

SYNOPSIS

paste [options] files...

DESCRIPTION

paste merges lines from multiple files side by side. Each line from the first file is joined with the corresponding line from subsequent files, separated by tabs.
The tool is useful for combining data from different sources into columnar format.

PARAMETERS

-d list

Use characters from list as delimiters.
-s, --serial
Paste one file at a time.
-z, --zero-terminated
Use NUL as line delimiter.
--help
Display help.
--version
Display version.

CAVEATS

Files should have same number of lines for alignment. Delimiter cycles through list. Empty lines produce empty columns.

HISTORY

paste is a traditional Unix utility, part of POSIX and GNU coreutils. It has been standard in Unix systems since the early days, providing simple tabular data assembly.

SEE ALSO

cut(1), join(1), column(1), pr(1)

Copied to clipboard