The utility is invoked with the following syntax: paste
Description
Once invoked, will read all its arguments. For each corresponding line, 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, will output a newline character and move on to the next line. 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 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.
Options
The utility accepts the following options: -d 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, begins again at the first delimiter. , which causes 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 is a plain-text file that contains the following information:
and that is another plain-text file that contains the following information:
555-1234 555-9876 555-6743 867-5309
The following example shows the invocation of with and as well as the resulting output: $ paste names.txt numbers.txt Mark Smith 555-1234 Bobby Brown 555-9876 Sue Miller 555-6743 Jenny Igotit 867-5309 When invoked with the option, the output of is adjusted such that the information is presented in a horizontal fashion: $ paste -s names.txt numbers.txt Mark Smith Bobby Brown Sue Miller Jenny Igotit 555-1234 555-9876 555-6734 867-5309 Finally, the use of the option is illustrated in the following example: $ paste -d., names.txt numbers.txt Mark Smith.555-1234 Bobby Brown,555-9876 Sue Miller.555-6743 Jenny Igotit,867-5309 As an example usage of both, the command can be used to concatenate multiple consecutive lines into a single row: $ paste -s -d '\t\n' names.txt Mark Smith Bobby Brown Sue Miller Jenny Igotit