{
    "content": [
        {
            "type": "text",
            "text": "# split (info)\n\n## Sections\n\n- **File: coreutils.info,  Node: split invocation,  Next: csplit invocation,  Prev: tail invocation,  Up: Output of parts of files** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "split",
        "section": "",
        "mode": "info",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "File: coreutils.info,  Node: split invocation,  Next: csplit invocation,  Prev: tail invocation,  Up: Output of parts of files",
                "lines": 1,
                "subsections": [
                    {
                        "name": "5.3 'split': Split a file into pieces.",
                        "lines": 211
                    }
                ]
            }
        ],
        "sections": {
            "File: coreutils.info,  Node: split invocation,  Next: csplit invocation,  Prev: tail invocation,  Up: Output of parts of files": {
                "content": "",
                "subsections": [
                    {
                        "name": "5.3 'split': Split a file into pieces.",
                        "content": "'split' creates output files containing consecutive or interleaved\nsections of INPUT (standard input if none is given or INPUT is '-').\nSynopsis:\n\nsplit [OPTION] [INPUT [PREFIX]]\n\nBy default, 'split' puts 1000 lines of INPUT (or whatever is left\nover for the last section), into each output file.\n\nThe output files' names consist of PREFIX ('x' by default) followed\nby a group of characters ('aa', 'ab', ... by default), such that\nconcatenating the output files in traditional sorted order by file name\nproduces the original input file (except '-nr/N').  By default split\nwill initially create files with two generated suffix characters, and\nwill increase this width by two when the next most significant position\nreaches the last character.  ('yz', 'zaaa', 'zaab', ...).  In this way\nan arbitrary number of output files are supported, which sort as\ndescribed above, even in the presence of an '--additional-suffix'\noption.  If the '-a' option is specified and the output file names are\nexhausted, 'split' reports an error without deleting the output files\nthat it did create.\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'-l LINES'\n'--lines=LINES'\nPut LINES lines of INPUT into each output file.  If '--separator'\nis specified, then LINES determines the number of records.\n\nFor compatibility 'split' also supports an obsolete option syntax\n'-LINES'.  New scripts should use '-l LINES' instead.\n\n'-b SIZE'\n'--bytes=SIZE'\nPut SIZE bytes of INPUT into each output file.  SIZE may be, or may\nbe an integer optionally followed by, one of the following\nmultiplicative suffixes:\n'b'  =>            512 (\"blocks\")\n'KB' =>           1000 (KiloBytes)\n'K'  =>           1024 (KibiBytes)\n'MB' =>      1000*1000 (MegaBytes)\n'M'  =>      1024*1024 (MebiBytes)\n'GB' => 1000*1000*1000 (GigaBytes)\n'G'  => 1024*1024*1024 (GibiBytes)\nand so on for 'T', 'P', 'E', 'Z', and 'Y'.  Binary prefixes can be\nused, too: 'KiB'='K', 'MiB'='M', and so on.\n\n'-C SIZE'\n'--line-bytes=SIZE'\nPut into each output file as many complete lines of INPUT as\npossible without exceeding SIZE bytes.  Individual lines or records\nlonger than SIZE bytes are broken into multiple files.  SIZE has\nthe same format as for the '--bytes' option.  If '--separator' is\nspecified, then LINES determines the number of records.\n\n'--filter=COMMAND'\nWith this option, rather than simply writing to each output file,\nwrite through a pipe to the specified shell COMMAND for each output\nfile.  COMMAND should use the $FILE environment variable, which is\nset to a different output file name for each invocation of the\ncommand.  For example, imagine that you have a 1TiB compressed file\nthat, if uncompressed, would be too large to reside on disk, yet\nyou must split it into individually-compressed pieces of a more\nmanageable size.  To do that, you might run this command:\n\nxz -dc BIG.xz | split -b200G --filter='xz > $FILE.xz' - big-\n\nAssuming a 10:1 compression ratio, that would create about fifty\n20GiB files with names 'big-aa.xz', 'big-ab.xz', 'big-ac.xz', etc.\n\n'-n CHUNKS'\n'--number=CHUNKS'\n\nSplit INPUT to CHUNKS output files where CHUNKS may be:\n\nN      generate N files based on current size of INPUT\nK/N    only output Kth of N to stdout\nl/N    generate N files without splitting lines or records\nl/K/N  likewise but only output Kth of N to stdout\nr/N    like 'l' but use round robin distribution\nr/K/N  likewise but only output Kth of N to stdout\n\nAny excess bytes remaining after dividing the INPUT into N chunks,\nare assigned to the last chunk.  Any excess bytes appearing after\nthe initial calculation are discarded (except when using 'r' mode).\n\nAll N files are created even if there are fewer than N lines, or\nthe INPUT is truncated.\n\nFor 'l' mode, chunks are approximately INPUT size / N.  The INPUT\nis partitioned into N equal sized portions, with the last assigned\nany excess.  If a line starts within a partition it is written\ncompletely to the corresponding file.  Since lines or records are\nnot split even if they overlap a partition, the files written can\nbe larger or smaller than the partition size, and even empty if a\nline/record is so long as to completely overlap the partition.\n\nFor 'r' mode, the size of INPUT is irrelevant, and so can be a pipe\nfor example.\n\n'-a LENGTH'\n'--suffix-length=LENGTH'\nUse suffixes of length LENGTH.  If a LENGTH of 0 is specified, this\nis the same as if (any previous) '-a' was not specified, and thus\nenables the default behavior, which starts the suffix length at 2,\nand unless '-n' or '--numeric-suffixes=FROM' is specified, will\nauto increase the length by 2 as required.\n\n'-d'\n'--numeric-suffixes[=FROM]'\nUse digits in suffixes rather than lower-case letters.  The\nnumerical suffix counts from FROM if specified, 0 otherwise.\n\nFROM is supported with the long form option, and is used to either\nset the initial suffix for a single run, or to set the suffix\noffset for independently split inputs, and consequently the auto\nsuffix length expansion described above is disabled.  Therefore you\nmay also want to use option '-a' to allow suffixes beyond '99'.\nNote if option '--number' is specified and the number of files is\nless than FROM, a single run is assumed and the minimum suffix\nlength required is automatically determined.\n\n'-x'\n'--hex-suffixes[=FROM]'\nLike '--numeric-suffixes', but use hexadecimal numbers (in lower\ncase).\n\n'--additional-suffix=SUFFIX'\nAppend an additional SUFFIX to output file names.  SUFFIX must not\ncontain slash.\n\n'-e'\n'--elide-empty-files'\nSuppress the generation of zero-length output files.  This can\nhappen with the '--number' option if a file is (truncated to be)\nshorter than the number requested, or if a line is so long as to\ncompletely span a chunk.  The output file sequence numbers, always\nrun consecutively even when this option is specified.\n\n'-t SEPARATOR'\n'--separator=SEPARATOR'\nUse character SEPARATOR as the record separator instead of the\ndefault newline character (ASCII LF). To specify ASCII NUL as the\nseparator, use the two-character string '\\0', e.g., 'split -t\n'\\0''.\n\n'-u'\n'--unbuffered'\nImmediately copy input to output in '--number r/...' mode, which is\na much slower mode of operation.\n\n'--verbose'\nWrite a diagnostic just before each output file is opened.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n\nHere are a few examples to illustrate how the '--number' ('-n')\noption works:\n\nNotice how, by default, one line may be split onto two or more:\n\n$ seq -w 6 10 > k; split -n3 k; head xa?\n==> xaa <==\n06\n07\n==> xab <==\n\n08\n0\n==> xac <==\n9\n10\n\nUse the \"l/\" modifier to suppress that:\n\n$ seq -w 6 10 > k; split -nl/3 k; head xa?\n==> xaa <==\n06\n07\n\n==> xab <==\n08\n09\n\n==> xac <==\n10\n\nUse the \"r/\" modifier to distribute lines in a round-robin fashion:\n\n$ seq -w 6 10 > k; split -nr/3 k; head xa?\n==> xaa <==\n06\n09\n\n==> xab <==\n07\n10\n\n==> xac <==\n08\n\nYou can also extract just the Kth chunk.  This extracts and prints\njust the 7th \"chunk\" of 33:\n\n$ seq 100 > k; split -nl/7/33 k\n20\n21\n22\n"
                    }
                ]
            }
        }
    }
}