Man page of paste
Section: User Commands (1)
Return to Main Contents
paste - Joins corresponding lines of several files or subsequent lines in one file
paste [-d list] [-s] file...
Interfaces documented on this reference page conform to industry standards
paste: XPG4, XPG4-UNIX
Refer to the
reference page for more information
about industry standards and associated tags.
Replaces the delimiter that separates lines in the output
(tab by default) with one or more characters from
contains more than one character, then
the characters are repeated in order until the end of the output. In parallel
merging, the lines from the last file always end with a newline character,
instead of one from
The following special characters can be used in
Empty string (not a null character)
[Compaq] An extended character
You must quote characters that have special meaning to the shell.
Merges all lines from each input file into one line of output
(serial merging). Using this option, the
merges all lines in the first input file forcing a newline before at the end.
The command then continues with the next input file, continuing in the same
manner until all input files have been completed. A tab separates the input
lines unless you use the
option. Regardless of the
list, the last character of the output is a newline character.
The name of an input file. You may specify up to 12 files,
If you specify a
standard input recursively, one line for each
option or no options causes the
to treat each file as a column, joining them horizontally with a tab character
by default (parallel merging).
combines all lines of each input file into one output line (serial merging).
These lines are joined with the tab character by default.
Output lines can be any length.
[Compaq] The output of
is similar to the output produced by the
with its options creates extra spaces,
tabs, and lines for an enhanced page layout.
option is not used, it is an error if any
cannot be opened.
The following exit values are returned:
An error occurred.
To paste several columns of data together, enter:
paste names places dates > npd
This creates a file named
that contains the
in one column,
in another, and
in a third. The columns are separated
by tab characters.
rachel New York 28 February
jerzy Warsaw 27 April
mata Nairobi 21 June
michel Boca Raton 27 July
segui Managua 18 November
A tab character separates the name, place, and date on each line.
To separate the columns with a character other than a tab
paste -d"!@" names places dates > npd
This alternates the apostrophe (!) and the at sign
(@) as the column separators. If
are the same as in Example
rachel!New York@28 February
michel!Boca Raton@27 July
To display the standard input in multiple columns, enter:
ls | paste - - - -
This lists the current directory in four columns. Each hyphen (-) tells the
command to create a column
containing data read from the standard input. The first line is put in the
first column, the second line in the second column, ... and then the fifth
line in the first column, and so on.
This is equivalent to
ls | paste -d"\t\t\t\n" -s -
which fills the columns across the page with subsequent lines from the
standard input. The
defines the character to
insert after each column: a tab character (\t) after the
first three columns, and a newline character (\n) after
the fourth. Without the
paste -s -
displays all of the input as one line with a tab between each column.
To merge the lines of the file
above into one output line, enter:
paste -s names
This results in:
rachel jerzy mata michel segui
The following environment variables affect the execution of
Provides a default value for the internationalization variables
that are unset or null. If
is unset or null, the corresponding value from the default locale is used.
If any of the internationalization variables contain an invalid setting, the
utility behaves as if none of the variables had been defined.
If set to a non-empty string value, overrides the values of
all the other internationalization variables.
Determines the locale for the interpretation of sequences
of bytes of text data as characters (for example, single-byte as opposed to
multibyte characters in arguments and input files).
Determines the locale for the format and contents of diagnostic
messages written to standard error.
Determines the location of message catalogues for the processing
- EXIT STATUS
- ENVIRONMENT VARIABLES
- SEE ALSO
This document was created by
using the manual pages.
Time: 02:42:57 GMT, October 02, 2010