Split (Unix)
Encyclopedia
split is a Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 utility most commonly used to split a file
Computer file
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...

 into two or more smaller files.

Usage

The command-syntax
Syntax
In linguistics, syntax is the study of the principles and rules for constructing phrases and sentences in natural languages....

 is:

split [OPTION] [INPUT [PREFIX]]


The default behavior of split is to generate output files of a fixed size, default 1000 lines. The files are named by appending aa, ab, ac, etc. to output filename. If output filename is not given, the default filename of x is used, for example, xaa, xab, etc. When a hyphen (-) is used instead of input filename, data is derived from standard input.


To split filename to parts each 50 MB named partaa, partab, partac,....
split -b50m filename part

To join the files back together again use the cat
Cat (Unix)
The cat command is a standard Unix program used to concatenate and display files. The name is from catenate, a synonym of concatenate.- Specification :...

 command

cat xaa xab xac > filename


or


cat xa[a-c] > filename


Additional program options permit a maximum character count (instead of a line count), a maximum line length, how many incrementing characters in generated filenames, and whether to use letters or digits.

See also

  • csplit
    Csplit
    The csplit command in Unix is a utility that is used to split a file into two or more smaller files determined by context lines.-Usage:The command-syntax is: csplit ...

     - splits by content rather than by size
  • List of Unix utilities
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK