manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3 split: Split a file into fixed-size pieces

split creates output files containing consecutive sections of input (standard input if none is given or input is ‘-’). Synopsis:

 
split [option] [input [prefix]]

By default, split puts 1000 lines of input (or whatever is left over for the last section), into each output file.

The output files' names consist of prefix (‘x’ by default) followed by a group of characters (‘aa’, ‘ab’, … by default), such that concatenating the output files in traditional sorted order by file name produces the original input file. If the output file names are exhausted, split reports an error without deleting the output files that it did create.

The program accepts the following options. Also see Common options.

-l lines
--lines=lines

Put lines lines of input into each output file.

For compatibility split also supports an obsolete option syntax ‘-lines’. New scripts should use ‘-l lines’ instead.

-b size
--bytes=size

Put size bytes of input into each output file. size is a number which may be followed by one of these multiplicative suffixes:

 
b’  =>       512 ("blocks")
‘KB’ =>      1000 (KiloBytes)
‘K’  =>      1024 (KibiBytes)
‘MB’ => 1000*1000 (MegaBytes)
‘M’  => 1024*1024 (MebiBytes)

and so on for ‘G’, ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.

-C size
--line-bytes=size

Put into each output file as many complete lines of input as possible without exceeding size bytes. Individual lines longer than size bytes are broken into multiple files. size has the same format as for the ‘--bytes’ option.

-a length
--suffix-length=length

Use suffixes of length length. The default length is 2.

-d
--numeric-suffixes

Use digits in suffixes rather than lower-case letters.

--verbose

Write a diagnostic to standard error just before each output file is opened.

An exit status of zero indicates success, and a nonzero value indicates failure.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.