O'Reilly logo

Linux in a Nutshell, Fourth Edition by Aaron Weber, Stephen Figgins, Ellen Siever

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

split

Synopsis

                  split [options] [infile [prefix]]

Split infile into equal-sized segments. infile remains unchanged, and the results are written to prefix aa, prefix ab, and so on. The default prefix is x, giving the output files xaa, xab, etc. If infile is - or missing, standard input is read. See also csplit.

Options

- n

Split infile into n new files.

-a n, --suffix-length= n

Use suffixes of length n (default is 2).

-b n[b|k|m], --bytes= n[b|k|m]

Split infile into n-byte segments. Alternate blocksizes may be specified:

b

512 bytes.

k

1 kilobyte.

m

1 megabyte.

-C bytes[b|k|m], --line-bytes= bytes[b|k|m]

Put a maximum of bytes into file; insist on adding complete lines.

-l n, --lines= n

Split infile into n-line segments (default is 1000).

--help

Print a help message and then exit.

--verbose

Print a message for each output file.

--version

Print version information and then exit.

-

Take input from the standard input.

Examples

Break bigfile into 1000-line segments:

                  split bigfile

Join four files, then split them into 10-line files named new.aa, new.ab, and so on. Note that without the -, new. would be treated as a nonexistent input file:

                  cat list[1-4] | split -10 - new.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required