Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ csplit(1) — sys5 — Apollo Domain/IX SR9.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ed(1)

sh(1)

regexp(5)



CSPLIT(1)                DOMAIN/IX SYS5                 CSPLIT(1)



NAME
     csplit - context split

USAGE
     csplit [-s] [-k] [-f prefix ] file arg1 [ ... argn ]

DESCRIPTION
     Csplit reads a specified file and separates it into n+1 sec-
     tions, defined by the arguments arg1...  argn.  By default,
     it places the sections in xx00 ...  xxn (n may not be
     greater than 99).  These sections comprise the following
     pieces of file:

           00:   From the start of file up to (but not including)
                 the line referenced by arg1.
           01:   From the line referenced by arg1 up to the line
                 referenced by arg2.
                 .
                 .
                 .
           n+1:  From the line referenced by argn to the end of
                 file.

     If the file argument is a - then standard input is used.

OPTIONS
     -s         Suppress the character counts for each file
                created.

     -k         Leave previously-created files intact (even if an
                error occurs when using csplit).

     -f prefix  Name the created files prefix 00 ... prefixn.
                The default is xx00 ...  xxn.

ARGUMENTS
           /rexp/  Create a file for the section, from the
                   current line, up to (but not including) the
                   line containing the regular expression rexp.
                   The current line becomes the line containing
                   rexp.  The argument may be followed by an
                   optional + or - some number of lines (e.g.,
                   /Page/-5).

           %rexp%  Same as /rexp/, except that no file is created
                   for the section.

           lnno    Create a file from the current line, up to
                   (but not including) lnno.  The current line
                   becomes lnno.



Printed 12/4/86                                          CSPLIT-1







CSPLIT(1)                DOMAIN/IX SYS5                 CSPLIT(1)



           {num}   Repeat argument.  May follow any of the above
                   arguments.  If it follows a rexp-type argu-
                   ment, that argument is applied num more times.
                   If it follows lnno, the file will be split
                   every lnno lines (num times) from that point.

EXAMPLES
     To create four files, cobol00 ... cobol03, type the follow-
     ing:

       # csplit -f cobol file  '/procedure division/'  /par5./  /par16./


     To recombine the ``split'' files after they have been
     edited, use this:

       # cat cobol0[0-3] > file


     To overwrite the original file, type the following command:

       # csplit -k file  100  {99}

     To split the file at every 100 lines, up to 10,000 lines --
     and to retain the created files if there are less than
     10,000 lines, use this command:

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

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

CAUTIONS
     Place all rexp-type arguments containing blanks or other
     characters meaningful to sh in appropriate quotes.

     Regular expressions may not contain embedded newlines.

     Csplit does not affect the original file; therefore, the
     file is not automatically removed after using csplit.

DIAGNOSTICS
     Self-explanatory except for ``arg - out of range'', which
     means that the given argument does not reference a line
     between the current position and the end of the file.






CSPLIT-2                                          Printed 12/4/86







CSPLIT(1)                DOMAIN/IX SYS5                 CSPLIT(1)



RELATED INFORMATION
     ed(1)
     sh(1)
     regexp(5)

















































Printed 12/4/86                                          CSPLIT-3





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026