title: Paste (Unix)
text: # Paste (Unix)
  
  paste is a Unix command line utility which is used to join files horizontally (parallel merging) by outputting lines consisting of the sequentially corresponding lines of each file specified, separated by tabs, to the standard output.
  
  ## History
  
  The original Bell Labs version was written by Gottfried W. R. Luderer. The version of paste bundled in GNU coreutils was written by David M. Ihnat and David MacKenzie. The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.
  
  ## Usage
  
  The paste utility is invoked with the following syntax:
  
  ## Description
  
  Once invoked, paste will read all its file arguments. For each corresponding line, paste will append the contents of each file at that line to its output along with a tab. When it has completed its operation for the last file, paste will output a newline character and move on to the next line.
  
  paste exits after all streams return end of file. The number of lines in the output stream will equal the number of lines in the input file with the largest number of lines. Missing values are represented by empty strings.
  
  Though potentially useful, an option to have paste emit an alternate string for a missing field (such as "NA") is not standard.
  
  A sequence of empty records at the bottom of a column of the output stream may or may not have been present in the input file corresponding to that column as explicit empty records, unless you know the input file supplied all rows explicitly (e.g. in the canonical case where all input files all do indeed have the same number of lines).
  
  ## Options
  
  The paste utility accepts the following options:
  
  -d|--delimiters delimiters, which specifies a list of delimiters to be used instead of tabs for separating consecutive values on a single line. Each delimiter is used in turn; when the list has been exhausted, paste begins again at the first delimiter.
  
  -s|--serial, which causes paste to append the data in serial rather than in parallel; that is, in a horizontal rather than vertical fashion.
  
  ## Examples
  
  For the following examples, assume that names.txt is a plain-text file that contains the following information:
  
  and that numbers.txt is another plain-text file that contains the following information:
  
  The following example shows the invocation of paste with names.txt and numbers.txt as well as the resulting output:
  
  When invoked with the --serialize option (-s on BSD or older systems), the output of paste is adjusted such that the information is presented in a horizontal fashion:
  
  Finally, the use of the --delimiters option (-d on BSD or older systems) is illustrated in the following example:
  
  As an example usage of both, the paste command can be used to concatenate multiple consecutive lines into a single row:
  
  