File split on hex string

Z

zmaki

Please help :

Need to split big file into many small files (chunks).

Each chunk should start on the same hex-string, and end immediately before
next such hex-string in big file, where new chunk should start. Chunks
should be automaticaly sequentially named and saved.

Is there any freeware/shareware program, where I can select big file, enter
hex-string, and program will do the above described procedure automatically
?

zmaki
 
B

B. R. 'BeAr' Ederson

Need to split big file into many small files (chunks).

Each chunk should start on the same hex-string, and end immediately before
next such hex-string in big file, where new chunk should start. Chunks
should be automaticaly sequentially named and saved.

Is there any freeware/shareware program, where I can select big file, enter
hex-string, and program will do the above described procedure automatically

Clay Ruth has a DOS and a Win32(Beta) command line utility which both
do what you want. You can download them here:

http://n9cr.redirectme.net/claysutl.html

Please note that the programs work directly on the original (your input
file)! And both only do one split on one run. To do multiple splits
you may want to write a batch to do the repetitive calls of the split
program. A sample:

----------- Copy to a_split.bat -------------
set trg=1000
copy %1 %1.%trg%
:next
set /A "trg+=1"
set /A "src=trg - 1"
Split32.exe %1.%src% %1.%trg% %2
if not errorlevel 1 goto next
---------------------------------------------

You need to call the above batch with the file to be split and the split
string as parameters, for instance:

a_split the_big_one.dat "^x00^xFF"

This should split your file the_big_one.dat right before each 00FFh
byte sequence - creating the files

the_big_one.dat.1000
the_big_one.dat.1001
the_big_one.dat.1002
:

If you don't need to recombine your files, than you can start the counter
with 0 (instead with 1000). I only chose 1000 because recombination is
easier when all numbers have the same count of digits.

If you're on a Win9x based system, you'll need a replacement for the
internal Set command to do arithmetic with environment variables. I
like ASet by Richard Breuer:

http://www.ricki.de/index-e.html

It is part of the Rutils40 package.

HTH.
BeAr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top