Paste (Unix program)

Paste (Unix program)

The paste utility is a program found on Unix-like and otherwise POSIX-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 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, 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 Igotit

and that numbers.txt is another plain-text file that contains the following information:

555-1234555-9876555-6743867-5309

The 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&section=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.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Unix-Kommandos — Unix Systeme zeichnen sich durch eine Vielzahl von Kommandos aus, mit denen sich über eine Shell das Betriebssystem bedienen lässt. Die Syntax dieser Kommandos weicht unter den verschiedenen Systemen voneinander ab. Es existieren die beiden… …   Deutsch Wikipedia

  • dd (Unix) — In computing, dd is a common Unix program whose primary purpose is the low level copying and conversion of raw data. According to the manual page for Version 7 Unix,[1] it will convert and copy a file . It is used to copy a specified number of… …   Wikipedia

  • dump (program) — dump is a Unix program used to back up file systems. It operates on blocks, below filesystem abstractions such as files and directories. Dump can back up a file system to a tape or another disk. It is often used across a network by piping its… …   Wikipedia

  • du (Unix) — example screenshot of du in a terminal du (abbreviated from disk usage) is a standard Unix program used to estimate file space usage space used under a particular directory or files on a file system. Contents …   Wikipedia

  • List of Unix utilities — This is a list of UNIX utilities as specified by IEEE Std 1003.1 2008, which is part of the Single UNIX Specification (SUS). These utilities can be found on UNIX Operating systems and most UNIX like operating systems. List IEEE Std 1003.1 2008… …   Wikipedia

  • od (Unix) — od is an octal dumping program for Unix and Unix like systems. It can also dump hexadecimal or decimal data. od is one of the earliest Unix programs, having appeared in version 1 AT T Unix. It is also specified in the POSIX standards (see… …   Wikipedia

  • dc (computer program) — dc is a cross platform reverse polish desk calculator which supports arbitrary precision arithmetic.[1] It is one of the oldest Unix utilities, predating even the invention of the C programming language; like other utilities of that vintage, it… …   Wikipedia

  • df (Unix) — df (abbreviation for disk free) is a standard Unix computer program used to display the amount of available disk space for filesystems on which the invoking user has appropriate read access. df is usually implemented by reading the mtab file or… …   Wikipedia

  • mount (Unix) — The Unix command line utility mount instructs the operating system that a file system is ready to use, and associates it with a particular point in the system s file system hierarchy (its mount point). The counterpart umount instructs the… …   Wikipedia

  • Plumber (program) — The plumber, in the Plan 9 from Bell Labs and Inferno operating systems, is a mechanism for interprocess communication, somewhat similar to copy and paste.The plumber is a program which handles all the messaging when programs make plumbing… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”