Notes › Resources › Numbering two public-domain classic TXT files: 582 of 1182 segments are empty and still take a number, and processed lines counts segments not lines

Numbering two public-domain classic TXT files: 582 of 1182 segments are empty and still take a number, and processed lines counts segments not lines

Measured on two public-domain classic TXT files: the Processed Lines box reports 1182 and 1342 because it counts split segments, not lines. The 582 and 676 empty segments still take a serial number and still receive the 4-byte affix, and padStart only pads.

Measuring the two files before anything is touched

The corpus for this run is two public-domain classic TXT files. The Travels of Lao Can is 332588 bytes long and splits into 1182 segments; Dream Pool Essays is 380203 bytes long and splits into 1342 segments. Neither carries a byte order mark, neither carries a carriage return, and both end with a single trailing newline. Counted in code points the two files hold 111707 and 127666 characters, and every character figure here is reported on that basis, since a Chinese character is one code point but several bytes. Measurement runs through the shared probe harness: the tool page script is read back verbatim and handed to node, with parameters injected by the harness rather than a real file picker. Interface pixels and elapsed time were not measured in this batch.

What the library listing shows for these two files is "TXT 324.8 KB" and "TXT 371.3 KB". That pair is exactly what you get by dividing the byte counts by 1024 and keeping one decimal place, so it is a display tier difference and not an independent reading. What nobody had measured on this page before is the back half of it, the add prefix/suffix tab and the add serial number tab. The two earlier tabs were measured on a code unit basis, and their conclusions are left alone below.

"Processed lines" counts segments, not lines

Point the Text Line Ops serial number tab at The Travels of Lao Can and the processed lines box reports 1182. Run the same tab on Dream Pool Essays and it reports 1342. For these two books, though, the segments that actually contain text number only 600 and 666. The denominator in that box is the segment count produced by splitting on newlines: of the 1182 segments, 582 are empty, and of the 1342 segments, 676 are empty, so the two books together give 2524 segments with 1258 blank. The real newline counts are 1181 and 1341, and neither is displayed, because a split always yields one more piece than there are separators and the trailing newline carves out a final piece of its own.

CorpusProcessed lines reportsNon-empty segmentsEmpty segmentsNewline characters
The Travels of Lao Can11826005821181
Dream Pool Essays13426666761341
Lao Can1182Dream Pool1342green = segments with text, gray = empty (600/582, 666/676)

Figure 1 Segment composition of the two corpora: inside the reported 1182 and 1342, green is the segments carrying text and gray is the empty ones that still take a number

The serial number box: blanks still take a number, width only pads

The arithmetic behind that box is idx = start + i, where i comes straight from the segment index, so an empty segment still occupies a place in the sequence. Under the default settings, 582 output lines from The Travels of Lao Can hold nothing but a serial number and a separator, and the last segment reads, character for character, "1182. ". Dream Pool Essays yields 676 such lines, and its highest serial number, 1342, overshoots the 666 segments that read as content by 676. The gap between line number N and the Nth thing anyone reads comes down to this one formula: that final line, "1182. ", is holding the number of the last empty segment. The blank carved out by the trailing newline collects a number too, which is why a three line sample returns an extra row reading "3. ".

Serial width is handed to the format dropdown, and padStart only pads, never truncates. Under a two digit format with 1182 segments, only 9 boxes gain a leading zero, 1173 are left untouched, 1083 render wider than 2 characters, and 183 of those push out a four digit number. With a three digit format the padded count becomes 99. A negative start is stranger: two digits emit "-5. " at length 2 with no padding, three digits emit "0-5. ". The zero lands before the minus sign, not before the digits.

The affix box: every byte goes to segments nobody sees

The default prefix is the literal value "★ ", where U+2605 occupies 3 bytes and the following space 1 more, so 4 bytes attach to every segment unconditionally. The affix pass on The Travels of Lao Can shows a growth of 4728 bytes and an output of 337316; on Dream Pool Essays the growth is 5368 and the output is 385571. Together the two books grow by 10096 bytes and produce 722887 bytes. Those 582 and 676 empty segments each move from 0 code points to 2, so the affix is applied most enthusiastically to the parts no reader will ever see, and growth tracks the segment count alone.

Lao Can 332588 +4728 → 337316Dream Pool 380203 +5368 → 385571Default prefix attaches 4 bytes per segment, growth 10096

Figure 2 The byte ledger of the affix tab under its default settings: input and output tiers after 4 bytes attach to every segment

The start box, the separator box, and no cleaning between tabs

The start box is parsed with parseInt(...,10)||0, which folds 0, an empty field, abc and 0x10 into one zero based result. A value of 2.9 is used as 2, a 4 surrounded by whitespace reads as 4, 1e2 stops at the letter and returns 1, and -5 does start below zero and walk up through the origin. Entering 99999999999999999999 lands on 1e20 and emits the 21 digit number 100000000000000000000, with the three line sample totalling 80 bytes. The separator box is another world: braces inside it take no part in placeholder substitution, so {n} comes back literally as "1.{n}甲" and {nn} as "1.{nn}甲". Choosing {nn}. as the format changes only the format side, so the line still reads 01.{n}甲.

On a CRLF sample the carriage return stays at the tail of each segment. Under default settings the output is "★ 甲\r\n★ 乙\r\n★ 丙", taking 13 bytes in and putting 25 out. With a suffix configured, the suffix is placed after the carriage return rather than before it, and the observed sequence is literally \rX, which contradicts the wording used in earlier copy for this page. The serial number tab carries the return along after number and content for the same reason.

Switching modes touches nothing but display and hint text. Seven parameters, including del-n=7, start=3 and a separator of | , were still exactly as entered after six round trips, and all 6 writes to control values during that cycling landed in the output box; the panels never scrub one another. The four tab hints occupy 41, 47, 51 and 52 bytes, and the hint baked into the markup differs from the delete tab hint in the script by 3 code points and 7 bytes, so two texts hang on one slot.

The ledger when output is pasted back into input

Run the affix tab twice in a row, feeding output straight back in, and each pass adds 4728 bytes for a cumulative growth of 9456, producing 342044 bytes while those 582 empty segments turn into "★ ★". The serial number tab grows by the same 5985 bytes per pass, since the digits account for 3621 of them and 2 bytes per segment for the rest. The last segment then reads "1182. 1182. ", the highest number is still 1182, and the statistics box still reports 1182, because numbers are recomputed each run and the previous ones have been demoted to ordinary text.

Three things that commonly fail to line up

Q: Why does processed lines disagree with the count I made myself?

Because that box counts the segments a split produces. Empty segments sit in the denominator, and so does the trailing piece cut out by the last newline, which is why it reports 1182 rather than the 1181 newlines in the file, and certainly not the 600 segments carrying text. For the has-text reading, strip the blank lines first. The same reasoning covers why the box will not budge on a second pass.

Q: Why did the serial numbers grow an extra digit?

Because padStart only pads, so a format width has no authority over a segment number already longer than it. Within 1182 segments, 183 boxes display a four digit number and only 9 were padded into that shape.

Q: Can I write {n} inside the separator?

No. Nothing in the separator box participates in placeholder substitution, so what you type there is concatenated literally: the observed line reads "1.{n}甲", braces and all.

Where the corpus came from

The two TXT files serve here purely as byte and paragraph material; nothing from either book is quoted and nothing about their prose is judged. To reproduce the readings on your own copy, the public-domain text is available from the resource detail pages for Dream Pool Essays and The Travels of Lao Can. Run each file once through the default settings, count the segments carrying text by hand, then look at the box and let the difference be the ledger for the empty ones.

📎 Related articles

15 sheet-music PDFs dragged into the File Info page: the largest lands 876.8 KB, short of the next tier by 150729 bytes, and the average size rounds twice 2026-11-14 Two Public-Domain Classics Merged into 555733 Bytes: the Panel Reads 2334 Lines and 187299 Characters, and Each Separator Tier Adds Its Own Slots 2026-11-13 Two Whole Public-Domain Classics Fed into the Text Reader: Line Counts at 81474 and 78497 Bytes, the Code Unit and Code Point Gap, and the GBK Misread Replacement-Character Bill 2026-11-12 Three Hash Implementations on One Page: Two Public-Domain TXTs as Byte Corpus, Measuring the Block Ledger and Encoding Mutations of file-md5 Character by Character 2026-11-09 Shenglü Qimen and Liweng Duiyun Fed Whole Into the Text Diff Page: 154 Common Lines, 665 Added, 401 Removed, and the Stats Line Gives Only Two Numbers 2026-11-08