paste(1)
NAME
paste − merge same lines of several files or subsequent lines of one file
SYNOPSIS
paste filename1 filename2...
paste −d list filename1 filename2...
paste −s [ −d list ] filename1 filename2...
AVAILABILITY
SUNWesu
DESCRIPTION
In the first two forms, paste concatenates corresponding lines of the given input files filename1, filename2, and so forth. It treats each file as a column or columns of a table and pastes them together horizontally (parallel merging). If you will, it is the counterpart of cat(1) which concatenates vertically, that is, one file after the other. In the last form above, paste replaces the function of an older command with the same name by combining subsequent lines of the input file (serial merging). In all cases, lines are glued together with the tab character, or with characters from an optionally specified list. Output is to the standard output, so it can be used as the start of a pipe, or as a filter, if − is used in place of a file name.
OPTIONS
−d list Without this option, the new-line characters of each but the last file (or last line in case of the −s option) are replaced by a tab character. This option allows replacing the tab character by one or more alternate characters (see below).
One or more characters immediately following −d replace the default tab as the line concatenation character. The list is used circularly, that is, when exhausted, it is reused. In parallel merging (that is, no −s option), the lines from the last file are always terminated with a new-line character, not from the list. The list may contain the special escape sequences: \n (new-line), \t (tab), \\ (backslash), and \0 (empty string, not a null character). Quoting may be necessary, if characters have special meaning to the shell (for instance, to get one backslash, use −d"\\\\" ).
−s Merge subsequent lines rather than one from each input file. Use tab for concatenation, unless a list is specified with −d option. Regardless of the list, the very last character of the file is forced to be a new-line.
− May be used in place of any file name, to read a line from the standard input. (There is no prompting).
EXAMPLES
The first example will list a directory in one column.
ls │ paste −d" " −
The second example will list a directory in four columns.
ls │ paste − − − −
The next example will combine pairs of lines into lines.
paste −s −d"\t\n" file
ENVIRONMENT
If any of the LC_∗ variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the environment, the operational behavior of paste for each corresponding locale category is determined by the value of the LANG environment variable. If LC_ALL is set, its contents are used to override both the LANG and the other LC_∗ variables. If none of the above variables is set in the environment, the "C" (U.S. style) locale determines how paste behaves.
LC_CTYPE
Determines how paste handles characters. When LC_CTYPE is set to a valid value, paste can display and handle text and filenames containing valid characters for that locale. paste can display and handle Extended Unix Code (EUC) characters where any individual character can be 1, 2, or 3 bytes wide. paste can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid.
LC_MESSAGES
Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses. In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English).
SEE ALSO
cut(1), grep(1), pr(1), environ(5)
DIAGNOSTICS
"line too long" Output lines are restricted to 511 characters.
"too many files" Except for −s option, no more than 12 input files may be specified.
SunOS 5.1/SPARC — Last change: 14 Sep 1992