paste(1) [ultrix man page]
paste(1) General Commands Manual paste(1) Name paste - merge file data Syntax paste file1 file2... paste -dlist file1 file2... paste -s [-dlist] file1 file2... Description In the first two forms, concatenates corresponding lines of the given input files file1, file2, etc. It treats each file as a column or columns of a table and pastes them together horizontally (parallel merging). In the last form, the command combines 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 - Used in place of any file name, to read a line from the standard input. (There is no prompting). -dlist Replaces characters of all but last file with nontabs characters (default tab). One or more characters immediately following -d replace the default tab as the line concatenation character. The list is used circularly, i. e. when exhausted, it is reused. In parallel merging (i. e. 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: (new-line), (tab), \ (backslash), and (empty string, not a null character). Quoting may be necessary, if characters have special meaning to the shell (for example, to get one backslash, use -d"\\" ). 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). -s Merges 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. Examples ls | paste -d" " - list directory in one column ls | paste - - - - list directory in four columns paste -s -d" " file combine pairs of lines into lines 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. See Also cut(1), grep(1), pr(1) paste(1)
Check Out this Related Man Page
PASTE(1) BSD General Commands Manual PASTE(1) NAME
paste -- merge corresponding or subsequent lines of files SYNOPSIS
paste [-s] [-d list] file ... DESCRIPTION
The paste utility concatenates the corresponding lines of the given input files, replacing all but the last file's newline characters with a single tab character, and writes the resulting lines to standard output. If end-of-file is reached on an input file while other input files still contain data, the file is treated as if it were an endless source of empty lines. The options are as follows: -d list Use one or more of the provided characters to replace the newline characters instead of the default tab. The characters in list are used circularly, i.e., when list is exhausted the first character from list is reused. This continues until a line from the last input file (in default operation) or the last line in each file (using the -s option) is displayed, at which time paste begins selecting characters from the beginning of list again. The following special characters can also be used in list: newline character tab character \ backslash character Empty string (not a null character). Any other character preceded by a backslash is equivalent to the character itself. -s Concatenate all of the lines of each separate input file in command line order. The newline character of every line except the last line in each input file is replaced with the tab character, unless otherwise specified by the -d option. If '-' is specified for one or more of the input files, the standard input is used; standard input is read one line at a time, circularly, for each instance of '-'. EXIT STATUS
The paste utility exits 0 on success, and >0 if an error occurs. EXAMPLES
List the files in the current directory in three columns: ls | paste - - - Combine pairs of lines from a file into single lines: paste -s -d ' ' myfile Number the lines in a file, similar to nl(1): sed = myfile | paste -s -d ' ' - - Create a colon-separated list of directories named bin, suitable for use in the PATH environment variable: find / -name bin -type d | paste -s -d : - SEE ALSO
cut(1), lam(1) STANDARDS
The paste utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. HISTORY
A paste command appeared in Version 32V AT&T UNIX. BSD
June 25, 2004 BSD