The split command first appeared in Version 3 Unix1 and is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification.2 The version of split bundled in GNU coreutils was written by Torbjorn Granlund and Richard Stallman.3 The split command has also been ported to the IBM i operating system.4
The command-syntax is:
The default behavior of split is to generate output files of a fixed size, default 1000 lines. The files are named by appending aa, ab, ac, etc. to output filename. If output filename is not given, the default filename of x is used, for example, xaa, xab, etc. When a hyphen (-) is used instead of input filename, data is derived from standard input. The files are typically rejoined using a utility such as cat.
Additional program options permit a maximum character count (instead of a line count), a maximum line length, how many incrementing characters in generated filenames, and whether to use letters or digits.
Create a file named "myfile.txt" with exactly 3,000 lines of data:
Now, use the split command to break this file into pieces (note: unless otherwise specified, split will break the file into 1,000-line files):
As seen above, the split command has broken the original file (keeping the original intact) into three, equal in number of lines (i.e., 1,000), files: xaa, xab, and xac.
split(1) – FreeBSD General Commands Manual https://www.freebsd.org/cgi/man.cgi?query=split&sektion=1 ↩
split – Shell and Utilities Reference, The Single UNIX Specification, Version 4 from The Open Group https://pubs.opengroup.org/onlinepubs/9799919799/utilities/split.html ↩
"split(1): split file into pieces - Linux man page". linux.die.net. https://linux.die.net/man/1/split ↩
IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 2020-09-05. /wiki/IBM ↩