www.delorie.com/gnu/docs/textutils/coreutils_20.html   search  
Buy GNU books!

GNU Core-utils

[ < ] [ > ]   [ << ] [ 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 letters (`aa', `ab', ... by default), such that concatenating the output files in 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 2. Common options.

`-a length'
Use suffixes of length length. The default length is 2.

`-l lines'
Put lines lines of input into each output file.

On older systems, split supports an obsolete option `-lines'. POSIX 1003.1-2001 (see section 2.5 Standards conformance) does not allow this; use `-l lines' instead.

`-b bytes'
Put the first bytes bytes of input into each output file. Appending `b' multiplies bytes by 512, `k' by 1024, and `m' by 1048576.

`-C bytes'
Put into each output file as many complete lines of input as possible without exceeding bytes bytes. For lines longer than bytes bytes, put bytes bytes into each output file until less than bytes bytes of the line are left, then continue normally. bytes has the same format as for the `--bytes' option.

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

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003