paste (Unix)
paste
is a Unix utility that merges corresponding lines of files. It reads input lines from one or more files (or standard input if a file argument is omitted) and combines them into a single line separated by a delimiter. By default, the delimiter is a tab character.
The primary function of paste
is to horizontally concatenate files. Unlike utilities like cat
, which perform vertical concatenation (appending one file to the end of another), paste
merges files side-by-side, line by line. This is particularly useful for combining data from different sources where each file contains a similar type of information corresponding to the same record.
paste
offers options to customize its behavior. The -d
option allows you to specify a different delimiter character or string to separate the joined lines. The -s
option tells paste
to paste all the lines from one file before proceeding to the next, essentially serializing the input instead of parallelizing it. This transforms a multi-line file into a single line.
The utility is a standard part of most Unix-like operating systems and is commonly used in shell scripts for data manipulation and report generation. It's part of the Single UNIX Specification.