mewais
mewais

Reputation: 1337

How to copy lines of hexadecimal format using sed?

I have a memory dump file, I can view it in sublime in hexadecimal format and it looks like the following:

7f45 4c46 0201 0100 0000 0000 0000 0000 0400 3e00 0100 0000 0000 0000 0000 0000 4000 0000 0000 0000 a003 2900 0000 0000 0000 0000 4000 3800 1600 4000 1800 1700 0400 0000 0400 0000 1005 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

I'm writing a script to divide the memory dump to files, each file containing only one page (4096 on my system, should translate to 256 lines on sublime). I tried the following:

7f45 4c46 0201 0100 0000 0000 0000 0000 0400

as numbers go higher it still behaves weirdly, adding two hexadecimal numbers or whole lines all of a sudden!

I've exhausted my options, I think part of the problem is that all these commands treat the file as utf8 and behave improperly with null characters. anyway, is there any way I can copy properly from one hex file to another?

Upvotes: 0

Views: 329

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798436

split can split a file by number of bytes.

split -b 4K -d memory.dmp page

Upvotes: 2

Related Questions