|Skip Navigation Links|
|Exit Print View|
|man pages section 1: User Commands Oracle Solaris 11 Express 11/10|
- merge corresponding or subsequent lines of files
/usr/bin/paste [-options] [file...]
paste [-options] [file...]
paste concatenates the corresponding lines of a given input file and writes the resulting lines to standard output. By default, paste replaces the NEWLINE character of every line other than the last input file with the TAB character.
Unless the -s option is specified, if an end-of-file is encountered on one or more input files, but not all input files, paste behaves as if empty lines were read from the files on which end-of-file was detected.
Unless the -s option is specified, paste is limited by the underlying operating system on how many file operands can be specified.
If no file operands are given or if the file is -, paste reads from standard input. The start of the file is defined as the current offset.
The following options are supported:
list specifies a list of delimiters. These delimiters are used circularly instead of TAB to replace the NEWLINE character of the input lines. Unless the -s option is specified, the delimiter will be reset to the first element of list each time a line is processed from each file. The delimiter characters corresponding to list will be found by treating list as an ANSI-C string, except that the \0 sequence inserts the empty string instead of the null character.
Paste the lines of one file at a time rather than one line from each file. In this case if the -d option is specified the delimiter will be reset to the first in the list at the beginning of each file.
Prints built-in manual page in either plain text, HTML or nroff format.
Prints basic help information.
Prints version information.
The following operand is supported:
A path name of an input file. If - is specified for one or more of the files, the standard input will be used. The standard input will be read one line at a time, circularly, for each instance of -.
See largefile(5) for the description of the behavior of paste when encountering files greater than or equal to 2 Gbyte ( 231 bytes).
Example 1 Listing a Directory in One Column
The following example lists a directory in one column:
example% ls | paste -d" " -
Example 2 Listing a Directory in Four Columns
The following example lists a directory in four columns:
example% ls | paste - - - -
Example 3 Combining Pairs of Lines from a File into Single Lines
The following example combines pairs of lines from a file into single lines:
example% paste -s -d"\ t\ n" file
See environ(5) for descriptions of the following environment variables that affect the execution of paste: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following exit values are returned:
An error occurred.
See attributes(5) for descriptions of the following attributes: