Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bfs(1)

csplit(1)

statvfs(2)

split(1)                                                           split(1)

NAME
     split - split a file into pieces

SYNOPSIS
     split[ option]...[ file[ name]]

DESCRIPTION
     split divides a file into smaller segments, storing the segments in
     individual output files and leaving the original file unaltered. The
     output files are automatically numbered; split uses a suffix compris-
     ing two lowercase letters (aa, ab ... zz) from the current interna-
     tionalized environment for this purpose. The last file contains the
     remainder of the input file and may contain fewer lines than the
     number specified.

     If the number of output files required exceeds the maximum length
     allowed by the suffix, split does not write the last file (as this
     would contain more lines than specified) and terminates with the exit
     status >0. The files that have already been created are not deleted.

OPTIONS
     No option specified
          The output files are called xaa, xab etc. up to xzz in lexico-
          graphical sequence. In this case, split creates a maximum of 676
          output files.

     -a number
          The suffix for the output file consists of number letters. For
          example, -a 4 creates the output files xaaaa, xaaab etc. up to
          xzzzz.

          -a not specified: The suffix consists of 2 letters.

     -b bytes
          split splits the input file into sections of size bytes. bytes
          can be specified as follows:

          n    as the number of bytes

          nk   as a multiple of 1024 bytes

          nm   as a multiple of 1048576 bytes

     -l lines
          split splits the input file into sections containing lines lines.

          This corresponds to the old option - lines, which is still sup-
          ported.

          -l not specified: split splits the input file into sections con-
          taining 1000 lines.




Page 1                       Reliant UNIX 5.44                Printed 11/98

split(1)                                                           split(1)

     --   End of the list of options. Must be specified if file begins with
          -.

     file Name of the input file you want to split.

          If you use a dash (-) as the name for file, split reads from
          standard input.

          file not specified:

          split reads from standard input.

     name Name of the output files: The first output file is given the name
          nameaa, the second receives the name nameab, and so on, up to
          namezz.

          name must therefore be two characters shorter (or number charac-
          ters if -a is specified) than the maximum permitted filename
          length ({NAMEMAX} bytes) in the relevant file system.

          If you specify a value for name, the file argument is mandatory.

EXIT STATUS
     0    The input file was split successfully

     >0   An invalid option was specified or an error occurred

LOCALE
     The LCMESSAGES environment variable governs the language in which
     message texts are displayed. If LCMESSAGES is undefined or is defined
     as the null string, it defaults to the value of LANG. If LANG is like-
     wise undefined or null, the system acts as if it were not internation-
     alized.

     The LCALL environment variable governs the entire locale. LCALL
     takes precedence over all the other environment variables which affect
     internationalization.

EXAMPLES
     Example 1

     The contents of the file example are to be split into several 20-line
     files:

     $ split -l 20 example
     $ ls
     example
     xaa
     xab
     xac
     xad



Page 2                       Reliant UNIX 5.44                Printed 11/98

split(1)                                                           split(1)

     Example 2

     Every two lines from the standard input are to be written into files
     named out... Since the names of output files are explicitly specified
     (out) in this case, the minus sign (-) for standard input must not be
     omitted!

     $ split -l 2 - out
     What is true was always true
     and will always remain true.
     But what is not true, was never reality
     and will never become reality.
     <CTRL-D>

     $ ls
     outaa
     outab

SEE ALSO
     bfs(1), csplit(1), statvfs(2).


































Page 3                       Reliant UNIX 5.44                Printed 11/98

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