← All 159 books split, one piece per page
One piece per page

split, one piece per page

Twenty-eight lessons on what split is: the split utility and why long files break into pieces; the default 1000-line pieces and the plain run that writes xaa, xab and xac; the suffix alphabet with -d digits and -a length, naming pieces with your own prefix; sizing with -l lines, -b bytes and -C whole lines, and the day the suffixes run out; rejoining with cat, the cmp proof, glob order and the stale piece trap; csplit by content, splitting stdin, the quiet pipeline half and large files with -n; when not to split, the keeper command, the naming ritual, and teaching a friend one honest hour.


Steve Hodgkiss 7 lessons

One file, one cut, one honest hour. That's the rhythm.

split, one piece per page

Twenty-eight lessons on what split is: the split utility and why long files break into pieces; the default 1000-line pieces and the plain run that writes xaa, xab and xac; the suffix alphabet with -d digits and -a length, naming pieces with your own prefix; sizing with -l lines, -b bytes and -C whole lines, and the day the suffixes run out; rejoining with cat, the cmp proof, glob order and the stale piece trap; csplit by content, splitting stdin, the quiet pipeline half and large files with -n; when not to split, the keeper command, the naming ritual, and teaching a friend one honest hour.


Set in Space Grotesk, Inter and JetBrains Mono (SIL Open Font License).

Every fact in this book is as the official source states it, fetched and read during this build: the local manual pages split(1), csplit(1) and cat(1) (GNU coreutils 9.4), the definition of truth for this book, and the Wikipedia articles Split (Unix), Csplit, Cat (Unix), Standard streams, GNU Core Utilities, Seq (Unix), Dd (Unix), Cut (Unix) and Nl (Unix). No facts are sourced from Reddit, Stack Overflow, vendor blogs or commercial sites. Every command and output pair was run on this machine with temporary files under the build scratch directory only, each capture cached verbatim so the pair is reproducible. The piece-name room counts 26, 676 and 17576 are derived from the base-26 suffix alphabet, computed during this build and labeled as derived. Honest note: the requested Coreutils title redirected and was read at GNU Core Utilities. SAFETY LAW: no file outside the book directory's scratch area was written by any demonstration; every run was read-only toward the rest of the machine, and sudo was never invoked. An independent guide, not affiliated with or endorsed by the Free Software Foundation, the IEEE, or the Wikimedia Foundation.

Your purchase is for personal use only. You do not have redistribution rights: please do not share, resell, or republish this book or its pages.

© 2026 Steve Hodgkiss. All rights reserved. Personal use only; no redistribution rights.

Edition 1.0 · stevehodgkiss.net

Contents

Contents


Part 1 · The whole file
The thousand lines4
Part 2 · The plain run
Count the pieces5
Part 3 · Names for pieces
Your own prefix6
Part 4 · Sizing the pieces
Suffixes run out7
Part 5 · The rejoin
The stale piece8
Part 6 · The wider field
stdin or a name9
Part 7 · The long view
Teaching split10

Per the Wikipedia Split (Unix) article, the default behavior of split is to generate output files of a fixed size, default 1000 lines. Per the split(1) manual page, output pieces of FILE go to PREFIXaa, PREFIXab and so on, with default size 1000 lines and default PREFIX 'x'. This machine's capture: wc --lines on the pieces answered 1000, 1000 and 600.

Split companion · No. 01
the default

The thousand lines

1000 lines per piece

the line counter, and the thousandline number:11000100120002600xaa1000 linesxab1000 linesxac600 linesthe default, twice over:fixed size, default 1000 lines(the article); default size is1000 lines (the manual page)$ wc --lines xa*1000 1000 600, total 2600a thousand lines a piece: the number every flag in this book exists to change

The number built into the tool. The article: output files of a fixed size, default 1000 lines; the manual page agrees: default size is 1000 lines, default PREFIX 'x'.

Our capture: split big.txt with no flags, then wc --lines xa* answered 1000 xaa, 1000 xab, 600 xac, 2600 total.

A thousand lines a piece: the rhythm every flag later in this book exists to change.

ONE HONEST HOUR

Run one flagless split on a file over 2000 lines, then count every piece and find the thousand.

Per the Wikipedia Split (Unix) article, its example runs wc --lines xa* after splitting myfile.txt and prints 1000 xaa, 1000 xab, 1000 xac and 3000 total. This machine's capture: wc --lines xaa xab xac big.txt answered 1000, 1000, 600 and 2600.

Split companion · No. 02
the audit

Count the pieces

wc --lines on the pieces

the audit the article itself runs$ wc --lines xa* 1000 xaa 1000 xab 600 xac 2600 totalthe pieces sum to the wholethe article's example runswc --lines xa* and reads1000 xaa, 1000 xab,1000 xac, 3000 totalour file answers 1000, 1000,600: same audit, honest tailcount after every split: the day the total disagrees, something else wrote

The article's own audit: after splitting, it runs wc --lines xa* and reads 1000 xaa, 1000 xab, 1000 xac, 3000 total.

Our capture on the 2600-line file: wc --lines xaa xab xac big.txt answered 1000, 1000, 600, 2600. The pieces sum to the whole.

Count after every split: the day the total disagrees with the original is the day something else wrote to the directory.

ONE HONEST HOUR

Split any file, then let wc --lines star-expand the pieces and check the total against the original.

Per the split(1) manual page, output pieces of FILE go to PREFIXaa and so on, the synopsis takes FILE [PREFIX], and --additional-suffix=SUFFIX appends an additional SUFFIX to file names. This machine's captures: split -l 4 twelve.txt part_ wrote part_aa to part_ac, and with --additional-suffix=.txt, part_aa.txt to part_ac.txt.

Split companion · No. 03
the name

Your own prefix

name the pieces yourself

name the pieces, and they belong$ split -l 4 twelve.txt part_part_aapart_abpart_acyour prefix, the article's aa ab ac$ ls part_*part_aa part_ab part_acwith an additional suffix:$ split --additional-suffix=.txt twelve.txtpart_aa.txtpart_ab.txtpieces that look like documents,still counted underneathFILE [PREFIX] plus --additional-suffix: pieces a stranger could rejoin by name

x is only the default. The manual page sends pieces to PREFIXaa, PREFIXab, and the synopsis takes FILE [PREFIX]: name them yourself.

Our captures: split -l 4 twelve.txt part_ wrote part_aa, part_ab, part_ac; adding --additional-suffix=.txt wrote part_aa.txt, pieces that look like documents, still counted underneath.

A prefix states where a piece belongs: part_, batch_, week10_. Name pieces so a stranger could guess the rejoin order.

ONE HONEST HOUR

Split one file with a prefix that names the job, then prove a stranger could guess the rejoin order.

Per the split(1) manual page, -a generates suffixes of length N, default 2, and -d uses numeric suffixes starting at 0. This machine's capture: seq 1 28 | split -l 1 -a 1 - printed split: output file suffixes exhausted and exited with status 1 after writing 26 pieces.

Split companion · No. 04
the wall

Suffixes run out

the names run out first

the names run out before the file does$ seq 1 28 | split -l 1 -a 1 -xaaxab...xazpiece 27 has no namesplit: output file suffixes exhaustedexit status: 126 one-letter names on the shelf:676 at two letters, 17576 at threea late failure is quiet:26 pieces were alreadywritten before the stopthe fix is room: -a 3,or -d digits; count thepieces when a split stopsexhausted suffixes, exit status 1: the name shelf, not the disk, gave out

Names are a finite shelf. Our capture hit the wall: seq 1 28 | split -l 1 -a 1 - wrote xaa through xaz, then stopped with output file suffixes exhausted, exit status 1.

Twenty-six pieces were already on disk when it stopped: a late, quiet failure. The fix is room: -a 3, or -d for digits.

When a split fails late, count the pieces. Twenty-six means the name shelf gave out, not the disk.

ONE HONEST HOUR

Build the wall yourself with -a 1 on 28 lines, count the pieces left behind, then rerun with -a 2.

Per this book's plan, the danger of re-splitting into a used prefix: split writes only as many pieces as the new input needs, and older pieces keep their old bytes. This machine's capture: after split -l 4 twelve.txt made 4, 4, 4, a second split -l 4 small.txt left xaa at 2 lines while xab and xac kept 4 each, cat x* answered 10 lines, and cmp failed.

Split companion · No. 05
the trap

The stale piece

old pieces survive the re-split

the re-split that never cleans upSIMULATIONof the trap, on scratch files$ split -l 4 small.txt (2 lines)xaa 2 linesxab 4 linesxac 4 linesnew bytesstale, first runstale, first runcat x* answered 10 lines for a 2-line filesplit writes only as manypieces as the input needs;older pieces keep theirold bytes, per this runthe rejoin cannot tell newbytes from stale onesclear the old pieces before re-splitting into the same prefix

The red page. Our capture: split -l 4 twelve.txt wrote 4, 4, 4. Then split -l 4 small.txt wrote a 2-line xaa and stopped: xab and xac still held the old 4 lines each.

The rejoin told the truth: cat x* answered 10 lines for a 2-line file, and cmp failed with EOF after byte 8.

split never cleans up after itself. Clear the old pieces before re-splitting into the same prefix; the rejoin cannot tell new bytes from stale ones.

ONE HONEST HOUR

Reproduce the trap: split, re-split smaller, cat the star, and find the stale lines with wc.

Per the split(1) manual page, with no FILE, or when FILE is -, split reads standard input. Per the Wikipedia Split (Unix) article, when a hyphen is used instead of the input filename, data is derived from standard input. This machine's capture: seq 1 12 | split -l 4 - pipe_ wrote pipe_aa to pipe_ac, and pipe_ab held 5 through 8.

Split companion · No. 06
the source

stdin or a name

a name, or the pipe

a name, or the pipeseq1 2 3 ... 12split -l 4 -pipe_aapipe_abpipe_acthe hyphen is the input slot:with no FILE, or when FILE is -,split reads standard input$ cat pipe_ab5678the middlepiece, fromthe pipeno temp file, no second step: the producer streams, split chunks

The input is optional. The manual page: with no FILE, or when FILE is -, read standard input; the article agrees, a hyphen means data is derived from standard input.

Our capture: seq 1 12 | split -l 4 - pipe_, and the pipe wrote pipe_aa, pipe_ab, pipe_ac; cat pipe_ab answered 5 6 7 8.

No temp file, no second step: the producer streams, split chunks. That is split as a pipeline citizen, not just a file tool.

ONE HONEST HOUR

Feed split from a pipe with the hyphen and a prefix, then cat the middle piece.

Per this book's plan, the last lesson hands split to a friend in one honest hour: five captured lines from this book, typed by the learner, read aloud by the teacher. The captures behind the five lines: the plain split, the wc audit, the -d run, the exhausted suffixes, and the silent cmp.

Split companion · No. 07
pass it on

Teaching split

one honest hour, one friend

five lines, one hour, one friend1split big.txt2wc --lines xa*: 1000, 1000, 6003split -d -l 4 twelve.txt: x00 x014suffixes exhausted, exit status 15cmp: nothing at allwhen they can say why the stalerejoin held ten lines, the houris done and the knife is theirsthey type, you read aloud,one honest hour, per the planpass the tool on: the last piece of the book is a friend

The last piece is passing the tool on: one friend, one honest hour, per this book's plan.

They type; you read aloud. The five lines are this book's captures: split big.txt, the wc that reads 1000, 1000, 600, split -d -l 4 twelve.txt, the wall that answers output file suffixes exhausted, and the cmp that says nothing.

When they can say why the stale rejoin held ten lines, the hour is done and the knife is theirs.

ONE HONEST HOUR

Sit with one friend and teach split in one sitting; they type the five lines, you read each answer aloud.

Index

Index


Count the pieces5
stdin or a name9
Suffixes run out7
Teaching split10
The stale piece8
The thousand lines4
Your own prefix6