OT: usage of split

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Jun 20 14:29:52 GMT 2005


On 2005-06-19 22:37, "Andrew L. Gould" <algould at datawok.com> wrote:
>On Sunday 19 June 2005 10:34 pm, Olivier Nicole wrote:
>>> 2.  How does one rejoin the resulting split files to recreate the
>>> original file?  I assume you can cat text files into a new file
>>> using redirection (>>); but can you do that with a binary file?
>>
>> I'd say yes, you can cat a binary file (though it is likely to
>> mess-up your screen).
>
> That's what virtual terminals are for!  ;-)
> What's a better way of rejoining split parts of a binary file?

If you split a binary file using split(1), then just rejoin the parts
with cat(1):

	% split -b 1400000 largefile.bin
	% cat x[a-z][a-z] > largefile2.bin

After these two steps, you should have:

	largefile.bin		The original binary file.

	xaa, xab, ...		Chunks of the original file that can fit
				in 1.4MB floppies (does anyone use these
				anymore?)

	largefile2.bin		A second copy of the original file, that
				was created by joining the x[a-z][a-z]
				chunks that split(1) created

After writing this post, I realized that split(1) doesn't have an
EXAMPLES section.  I think we should add one :)

- Giorgos



More information about the freebsd-questions mailing list