SH - Split (File)

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

split a file into pieces

3 - Syntax

split [OPTION] [INPUT [PREFIX]]

where: Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, …

Mandatory arguments to long options are mandatory for short options too.

Advertising

3.1 - Input

With no , or when INPUT is -, read standard input.

3.2 - Prefix, Suffix

default PREFIX is ‘x’ Options:

  • -a, –suffix-length=N: use suffixes of length N (default 2)
  • -d, –numeric-suffixes: use numeric suffixes instead of alphabetic

3.3 - Size

default size is 1000 lines. SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg. Size Options are:

  • -b, –bytes=SIZE: put SIZE bytes per output file
  • -C, –line-bytes=SIZE: put at most SIZE bytes of lines per output file
  • -l, –lines=NUMBER: put NUMBER lines per output file

3.4 - Support

  • –verbose: print a diagnostic to standard error just before each output file is opened
  • –help display this help and exit
  • –version: output version information and exit
Advertising