paste Command: Tutorial & Examples
Combine lines of files
paste command in Linux is a command-line utility used to merge lines of multiple files into a single file. It reads data from the specified files, one line at a time, and
writes the lines to the standard output, separated by a specified delimiter. The basic syntax of the command is:
paste [options] file1 [file2 ...]
-d option is used to specify a delimiter, which separates the lines from the different files. The default delimiter is the tab character.
For example, the command
paste file1.txt file2.txt will concatenate the contents of
file2.txt, and the output will be written to the standard output.
file1.txt contains the lines
file2.txt contains the lines
line6, the resulting output will
-s option can be used to concatenate the contents of all the files horizontally(side by side) instead of vertically.
The paste command can be useful for combining data from multiple files into a single file for further processing, or for creating a single file from a series of smaller files.