DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

split(C)


split -- split a file into pieces

Syntax

split [ -l line_count ] [ -a suffix_length ] [ file [ name ] ]

split [ -b n[k|m] ] [ -a suffix_length ] [ file [ name ] ]

split [ -line_count ] [ -a suffix_length ] [ file [ name ] ]

Description

The split command reads file and writes it in as many n-line pieces as necessary (default 1000), onto a set of output files. The name of the first output file is name with aa appended, and so on lexicographically. If no output name is given, x is default.

The following options are recognized:


-l line_count
-line_count
Specifies the number of lines in the resulting file.

-a suffix_length
Specifies that suffix_length letters are to be used to form the suffix portion of the filenames of the split files.

-b n
Specifies that the file is to be split into n byte pieces.

-b nk
Specifies that the file is to be split into n kilobyte pieces.

-b nm
Specifies that the file is to be split into n megabyte pieces.
If no input file is given, or if a dash (-) is given instead, the standard input file is used.

Exit values

split returns 0 on success, 1 on failure.

Examples

Split the file testfile (124 lines long) into fileaa, fileab, and fileac (50, 50, and 24 lines long respectively):

split -l 50 testfile file

See also

bfs(C), csplit(C)

Standards conformance

split is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005