HOME

TheInfoList



OR:

paste is a
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
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 In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
.


History

The version of paste bundled in
GNU GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were cr ...
was written by David M. Ihnat and David MacKenzie. The command is available as a separate package for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
as part of the
UnxUtils UnxUtils is a collection of ports of common GNU Unix-like utilities to native Win32, with executables only depending on the Microsoft C- runtime msvcrt.dll. The collection was last updated externally on April 15, 2003, by Karl M. Syring. The mo ...
collection of
native Native may refer to: People * Jus soli, citizenship by right of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Native Americans (disambiguation) In arts and entert ...
Win32 The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
ports A port is a maritime facility comprising one or more wharves or loading areas, where ships load and discharge cargo and passengers. Although usually situated on a sea coast or estuary, ports can also be found far inland, such as H ...
of common GNU Unix-like utilities.


Usage

The utility is invoked with the following syntax: paste 'options'' 'file1'' ..


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 (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 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, begins again at the first delimiter. -s, --serial, 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:
Mark Smith
Bobby Brown
Sue Miller
Jenny Igotit
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 ( on BSD or older systems), the output of is adjusted such that the information is presented in a horizontal fashion: $ paste --serialize 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 ( on BSD or older systems) is illustrated in the following example: $ paste --delimiters . 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 --serialize --delimiters '\t\n' names.txt Mark Smith Bobby Brown Sue Miller Jenny Igotit


See also

*
join Join may refer to: * Join (law), to include additional counts or additional defendants on an indictment *In mathematics: ** Join (mathematics), a least upper bound of sets orders in lattice theory ** Join (topology), an operation combining two top ...
*
cut Cut may refer to: Common uses * The act of cutting, the separation of an object into two through acutely-directed force ** A type of wound ** Cut (archaeology), a hole dug in the past ** Cut (clothing), the style or shape of a garment ** Cut (ea ...
*
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...
*lam(1), formatted paste with width and justification; not core Unix


References


External links

* {{Core Utilities commands Unix text processing utilities Unix SUS2008 utilities