Shell scripts and non-text files

Puppy related raves and general interest that doesn't fit anywhere else
Post Reply
Message
Author
User avatar
drongo
Posts: 374
Joined: Sat 10 Dec 2005, 23:35
Location: UK

Shell scripts and non-text files

#1 Post by drongo »

Another thread has prompted me to ask this question. I need to process two hex files to produce a third. I want to slice two large chunks (204 bytes) from the front of the hex files, compare the chunks and then append one or both to a third file. I want to repeat this until I run out of data. (I'm basically zipping two same sized MPEG Transport Streams into another the same size. There aren't any commercial tools or freeware available that will do exactly what I want.) The comparison will involve looking at two thirteen bit binary numbers.

All three files will be 270 MBytes in size (which is why I don't want to do this by hand with a hex-editor!)

I was going to use something like C or Basic to do this, but I'm wondering if it could be done with a shell script instead. Is it possible to grep (or equivalent function) a 13 bit binary word and then do a comparison or examine the binary string? Everything I have read about shell scripting seems to describe processing byte-aligned data containing printable strings. I'd be delighted if someone could disprove this. I've tried googling but not come up with any relevant results.

I should probably add that this is totally legit. I'm not editing copyrighted DVDs or anything, I'm producing a test stream from a hex file I have generated and some colour bars.

Thanks guys.

Post Reply