Deleting cyclic data string and creat... Log Out | Topics | Search
Moderators | Edit Profile

X-Ways Support Forum » Advanced Features » Deleting cyclic data string and creating new file « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Douglas S. Lacey (Thx99)
Posted on Tuesday, Nov 29, 2005 - 1:22:   

I'm not sure if this is the right forum for my question, but here goes...

I have a file which is divided into 510-byte blocks, each comprised of a 10-byte header and 500 bytes of actual data. The header string is identical for each block.

I would like to create a new file which contains ONLY the actual data. I wish to strip out the 10-byte header from each block, leaving only the actual data bytes.

I have absolutely no experience with scripting but I have a feeling that a script would work nicely for what I'm looking to do. Or is there a simpler way that I can run this process automatically without scripting. Considering that the file has 9,020 blocks(!), I'd rather not do this manually.

Any assistance is greatly appreciated! Thanks!

Doug
thx99@cox.net
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Tuesday, Nov 29, 2005 - 1:27:   

This is a very good example of a problem that can be solved with a WinHex script.

I did not test the following, but principally it should work like that:

CloseAll
Open C:\sourcefile.dat
Open C:\outputfile.dat
{
NextObj
Move 10
Read MyBuffer 500
NextObj
Write MyBuffer
}[9020]
Top of pagePrevious messageNext messageBottom of page Link to this message

Douglas S. Lacey (Thx99)
Posted on Tuesday, Nov 29, 2005 - 2:09:   

Thanks a million, Stefan!

I read up a bit on scripts and modified it a bit as follows:

CloseAll
Open "C:\sourcefile.dat"
Create "C:\outputfile.dat" 0
{
NextObj
Move 10
Read MyBuffer 500
NextObj
Write MyBuffer
}[9020]

The "Open C:\outputfile.dat" command kept giving me an error, but the "Create" command works well. The only thing is that I have to delete the very last byte ("00") of the outputfile. Everything works like a charm after that!

Thanks again!

Doug

Add Your Message Here
Post:
Username: Posting Information:
Only registered users may post messages here, i.e. you need to have an account.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:
Forum operated by X-Ways Software Technology AG.