- Paste (Unix program)
The paste utility is a program found on
Unix-like and otherwisePOSIX -compliant operating systems. It is used to concatenate the contents of files for each corresponding line.Usage
The paste utility is invoked with the following syntax:
paste ["options"] ["file1" ..]
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.
Options
The paste utility accepts the following options:
-d "delimators", which specifies a list of
delimiter s 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, 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:
Mark SmithBobby BrownSue MillerJenny Igotitand that numbers.txt is another plain-text file that contains the following information:
555-1234555-9876555-6743867-5309The following example shows the invocation of paste with names.txt and numbers.txt as well as the resulting output:
$ paste names.txt numbers.txtMark Smith 555-1234Bobby Brown 555-9876Sue Miller 555-6743Jenny Igotit 867-5309 When invoked with the -s option, the output of paste is adjusted such that the information is presented in a horizontal fashion:
$ paste -s names.txt numbers.txtMark Smith Bobby Brown Sue Miller Jenny Igotit555-1234 555-9876 555-6734 867-5309 Finally, the use of the -d option is illustrated in the following example:
$ paste -d ., names.txt numbers.txtMark Smith.555-1234Bobby Brown,555-9876Sue Miller.555-6743Jenny Igotit,867-5309 References
"PASTE(1)". "FreeBSD General Commands Manual". <http://www.freebsd.org/cgi/man.cgi?query=paste§ion=1&format=html>
"8.2 paste: Merge lines of files". "GNU text utilities: paste invocation". <http://www.gnu.org/software/textutils/manual/textutils/html_node/textutils_35.html>
ee also
*paste(1)
*cut(1)
*sed (1)
*awk(1)External links
* [http://www.linuxmanpages.com/man1/paste.1.php] The program's
manpage
Wikimedia Foundation. 2010.