bsplit?

Thad P Floryan thad at cup.portal.com
Thu Feb 1 22:49:52 AEST 1990


ken at cs.rochester.edu (Ken Yap) in <1990Jan30.051455.7500 at cs.rochester.edu>
writes:

	Oh come on, what happened to reusing Unix tools?

	Here's a cheap bsplit, done in sh (hooray for redirection on builtins,
	fooey to csh on this point).

		for i in 1 2 3 4 5
		do
			dd bs=10k count=1 of=part$i
		done < foo

	Edit as appropriate.

Nothing's "wrong" with the above; thanks for the example and posting!

But, per "Edit as appropriate", one has to know beforehand how many parts
the original will be split into, and, here's the clinker to the above, your
example does NOT perserve sequential order if there are more than 9 parts
such that one could do (later, when repacking after a uucp) "zcat part* | .."
because "part10" collates after "part1" but BEFORE "part2".  In other words,
an "ls part*" would sequence part1, part10, part2, part3, ... , part9  which
is the incorrect order.

The output of bsplit (and my xsplit) preserves collating sequence per partaa,
partab, partac, ... partzz thus preserving the split-order.

The benefit of "bsplit" is evident when uucp'ing the 40- or 60- or 90-part
distributions from, say, osu-cis.  Consider just the GNU gcc; it's a 20+ part
archive on osu-cis, and the split-sequence is maintained (for zcat and UNIX'
wildcarding) due to "aa", "ab", ..., "bh" suffixes on the filenames.

Thad Floryan [ thad at cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]



More information about the Unix-pc.general mailing list