PASTE(1)                   POSIX Programmer's Manual                  PASTE(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       paste -- merge corresponding or subsequent lines of files

SSYYNNOOPPSSIISS
       paste [[-s]] [[-d _l_i_s_t]] _f_i_l_e...

DDEESSCCRRIIPPTTIIOONN
       The _p_a_s_t_e utility shall concatenate the corresponding lines of the
       given input files, and write the resulting lines to standard output.

       The default operation of _p_a_s_t_e shall concatenate the corresponding
       lines of the input files. The <newline> of every line except the line
       from the last input file shall be replaced with a <tab>.

       If an end-of-file condition is detected on one or more input files, but
       not all input files, _p_a_s_t_e shall behave as though empty lines were read
       from the files on which end-of-file was detected, unless the --ss option
       is specified.

OOPPTTIIOONNSS
       The _p_a_s_t_e utility shall conform to the Base Definitions volume of
       POSIX.1-2008, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       The following options shall be supported:

       --dd _l_i_s_t   Unless a <backslash> character appears in _l_i_s_t, each
                 character in _l_i_s_t is an element specifying a delimiter
                 character. If a <backslash> character appears in _l_i_s_t, the
                 <backslash> character and one or more characters following it
                 are an element specifying a delimiter character as described
                 below. These elements specify one or more delimiters to use,
                 instead of the default <tab>, to replace the <newline> of the
                 input lines. The elements in _l_i_s_t shall be used circularly;
                 that is, when the list is exhausted the first element from
                 the list is reused. When the --ss option is specified:

                  *  The last <newline> in a file shall not be modified.

                  *  The delimiter shall be reset to the first element of _l_i_s_t
                     after each _f_i_l_e operand is processed.

                 When the --ss option is not specified:

                  *  The <newline> characters in the file specified by the
                     last _f_i_l_e operand shall not be modified.

                  *  The delimiter shall be reset to the first element of list
                     each time a line is processed from each file.

                 If a <backslash> character appears in _l_i_s_t, it and the
                 character following it shall be used to represent the
                 following delimiter characters:

                 \n    <newline>.

                 \t    <tab>.

                 \\    <backslash> character.

                 \0    Empty string (not a null character). If ''\\00'' is
                       immediately followed by the character ''xx'', the
                       character ''XX'', or any character defined by the _L_C___C_T_Y_P_E
                       ddiiggiitt keyword (see the Base Definitions volume of
                       POSIX.1-2008, _C_h_a_p_t_e_r _7, _L_o_c_a_l_e), the results are
                       unspecified.

                 If any other characters follow the <backslash>, the results
                 are unspecified.

       --ss        Concatenate all of the lines of each separate input file in
                 command line order. The <newline> of every line except the
                 last line in each input file shall be replaced with the
                 <tab>, unless otherwise specified by the --dd option.

OOPPEERRAANNDDSS
       The following operand shall be supported:

       _f_i_l_e      A pathname of an input file. If ''--'' is specified for one or
                 more of the _f_i_l_es, the standard input shall be used; the
                 standard input shall be read one line at a time, circularly,
                 for each instance of ''--''.  Implementations shall support
                 pasting of at least 12 _f_i_l_e operands.

SSTTDDIINN
       The standard input shall be used only if one or more _f_i_l_e operands is
       ''--''.  See the INPUT FILES section.

IINNPPUUTT FFIILLEESS
       The input files shall be text files, except that line lengths shall be
       unlimited.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of
       _p_a_s_t_e:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2008, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s the precedence of internationalization variables
                 used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments and input
                 files).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written to standard
                 error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       Concatenated lines of input files shall be separated by the <tab> (or
       other characters under the control of the --dd option) and terminated by
       a <newline>.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Successful completion.

       >0    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       If one or more input files cannot be opened when the --ss option is not
       specified, a diagnostic message shall be written to standard error, but
       no output is written to standard output. If the --ss option is specified,
       the _p_a_s_t_e utility shall provide the default behavior described in
       _S_e_c_t_i_o_n _1_._4, _U_t_i_l_i_t_y _D_e_s_c_r_i_p_t_i_o_n _D_e_f_a_u_l_t_s.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       When the escape sequences of the _l_i_s_t option-argument are used in a
       shell script, they must be quoted; otherwise, the shell treats the
       <backslash> as a special character.

       Conforming applications should only use the specific
       <backslash>-escaped delimiters presented in this volume of
       POSIX.1-2008. Historical implementations treat ''\\xx'', where ''xx'' is not
       in this list, as ''xx'', but future implementations are free to expand
       this list to recognize other common escapes similar to those accepted
       by _p_r_i_n_t_f and other standard utilities.

       Most of the standard utilities work on text files. The _c_u_t utility can
       be used to turn files with arbitrary line lengths into a set of text
       files containing the same data. The _p_a_s_t_e utility can be used to create
       (or recreate) files with arbitrary line lengths. For example, if _f_i_l_e
       contains long lines:

           ccuutt --bb 11--550000 --nn ffiillee >> ffiillee11
           ccuutt --bb 550011-- --nn ffiillee >> ffiillee22

       creates ffiillee11 (a text file) with lines no longer than 500 bytes (plus
       the <newline>) and ffiillee22 that contains the remainder of the data from
       _f_i_l_e.  Note that ffiillee22 is not a text file if there are lines in _f_i_l_e
       that are longer than 500 + {LINE_MAX} bytes. The original file can be
       recreated from ffiillee11 and ffiillee22 using the command:

           ppaassttee --dd ""\\00"" ffiillee11 ffiillee22 >> ffiillee

       The commands:

           ppaassttee --dd ""\\00"" ......
           ppaassttee --dd """" ......

       are not necessarily equivalent; the latter is not specified by this
       volume of POSIX.1-2008 and may result in an error. The construct ''\\00''
       is used to mean ``no separator'' because historical versions of _p_a_s_t_e
       did not follow the syntax guidelines, and the command:

           ppaassttee --dd"""" ......

       could not be handled properly by _g_e_t_o_p_t().

EEXXAAMMPPLLEESS
        1. Write out a directory in four columns:

               llss || ppaassttee -- -- -- --

        2. Combine pairs of lines from a file into single lines:

               ppaassttee --ss --dd ""\\tt\\nn"" ffiillee

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _S_e_c_t_i_o_n _1_._4, _U_t_i_l_i_t_y _D_e_s_c_r_i_p_t_i_o_n _D_e_f_a_u_l_t_s, _c_u_t, _g_r_e_p, _p_r

       The Base Definitions volume of POSIX.1-2008, _C_h_a_p_t_e_r _7, _L_o_c_a_l_e, _C_h_a_p_t_e_r
       _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                             PASTE(1)
