manpagez: man (manual) pages & more
man paste(1)
Home | html | info | man
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 charac-
                 ters in list are used circularly, i.e., when list is
                 exhausted the first character from list is reused.  This con-
                 tinues 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:

                 \n    newline character
                 \t    tab character
                 \\    backslash character
                 \0    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 '\t\n' myfile

     Number the lines in a file, similar to nl(1):

           sed = myfile | paste -s -d '\t\n' - -

     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'') compat-
     ible.


HISTORY

     A paste command appeared in Version 32V AT&T UNIX.

BSD                              June 25, 2004                             BSD

Mac OS X 10.6 - Generated Thu Sep 17 20:08:15 CDT 2009