


      CCCCSSSSPPPPLLLLIIIITTTT((((1111))))                   ((((UUUUNNNNIIIIXXXX 5555....0000))))                  CCCCSSSSPPPPLLLLIIIITTTT((((1111))))



      NNNNAAAAMMMMEEEE
           csplit - context split

      SSSSYYYYNNNNTTTTAAAAXXXX
           ccccsssspppplllliiiitttt [----ssss] [----kkkk] [----ffff prefix]]]] file arg1 [... argn]

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _C_s_p_l_i_t reads _f_i_l_e and separates it into n+1 sections,
           defined by the arguments _a_r_g_1...  _a_r_g_n.  By default the
           sections are placed in xx00 ...  xx_n (_n may not be greater
           than 99).  These sections get the following pieces of _f_i_l_e:

                 00:   From the start of _f_i_l_e up to (but not including)
                       the line referenced by _a_r_g_1.
                 01:   From the line referenced by _a_r_g_1 up to the line
                       referenced by _a_r_g_2.
8                       ....
8                       ....
8                       ....
                 n+1:  From the line referenced by _a_r_g_n to the end of
                       _f_i_l_e.

           The options to _c_s_p_l_i_t are:

                 ----ssss         _C_s_p_l_i_t normally prints the character counts
                            for each file created.  If the ----ssss option is
                            present, _c_s_p_l_i_t suppresses the printing of
                            all character counts.

                 ----kkkk         _C_s_p_l_i_t normally removes created files if an
                            error occurs.  If the ----kkkk option is present,
                            _c_s_p_l_i_t leaves previously created files
                            intact.

                 ----ffff _p_r_e_f_i_x  If the ----ffff option is used, the created files
                            are named _p_r_e_f_i_x00000000 ... _p_r_e_f_i_x_n.  The
                            default is xxxxxxxx00000000 ...  xxxxxxxx_n.

           The arguments (_a_r_g_1 ...  _a_r_g_n) to _c_s_p_l_i_t can be a
           combination of the following:

                 /_r_e_x_p/  A file is to be created for the section from
                         the current line up to (but not including) the
                         line containing the regular expression _r_e_x_p.
                         The current line becomes the line containing
                         _r_e_x_p.  This argument may be followed by an
                         optional ++++ or ---- some number of lines (e.g.,
                         ////PPPPaaaaggggeeee////----5555).

                 %_r_e_x_p%  This argument is the same as /_r_e_x_p/, except
                         that no file is created for the section.

                 _l_n_n_o    A file is to be created from the current line
                         up to (but not including) _l_n_n_o.  The current


9      Page 1                                                   (9010-E)






      CCCCSSSSPPPPLLLLIIIITTTT((((1111))))                   ((((UUUUNNNNIIIIXXXX 5555....0000))))                  CCCCSSSSPPPPLLLLIIIITTTT((((1111))))



                         line becomes _l_n_n_o.

                 {_n_u_m}   Repeat argument.  This argument may follow any
                         of the above arguments.  If it follows a _r_e_x_p
                         type argument, that argument is applied _n_u_m
                         more times.  If it follows _l_n_n_o, the file will
                         be split every _l_n_n_o lines (_n_u_m times) from
                         that point.

           Enclose all _r_e_x_p type arguments that contain blanks or other
           characters meaningful to the Shell in the appropriate
           quotes.  Regular expressions may not contain embedded new-
           lines.  _C_s_p_l_i_t does not affect the original file; it is the
           users responsibility to remove it.

      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
                split -f cobol file  '/procedure division/'  /par5./  /par16./

           This example creates four files, ccccoooobbbboooollll00000000 ... ccccoooobbbboooollll00003333.  After
           editing the ``split'' files, they can be recombined as
           follows:

                          cat cobol0[0-3] > file

           Note that this example overwrites the original file.

                     csplit -k file  100  {99}

           This example would split the file at every 100 lines, up to
           10,000 lines.  The ----kkkk option causes the created files to be
           retained if there are less than 10,000 lines; however, an
           error message would still be printed.

                csplit -k prog.c  '%main(%'  '/^}/+1'  {20}

           Assuming that pppprrrroooogggg....cccc follows the normal CCCC coding convention
           of ending routines with a }}}} at the beginning of the line,
           this example will create a file containing each separate CCCC
           routine (up to 21) in pppprrrroooogggg....cccc.

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           ed(1), sh(1), regexp(5).

      DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
           Self explanatory except for:
                     arg - out of range
           which means that the given argument did not reference a line
           between the current position and the end of the file.







      Page 2                                                   (9010-E)



