0

I have some hex dumps that look like this:

0x000eb3a8 0005a5a8 0005a5b0    ........
0x000eb3b0 000e8918 0005a7b8    ........
0x000eb3b8 00056018 00000001    ..`.....
0x000eb3c0 00000000 000b8450    .......P
0x000eb3c8 000b83b0 00000007    ........
0x000eb3d0 000b8378 000b8358    ...x...X
0x000eb3d8 000cef70 000c95f8    ...p....

I want to parse the two columns in the middle, read them byte by byte (obviously, two characters represent one byte in hex notation) and write each byte into a binary file. I tried with awk, but couldn't find a way to write binary output. Can somebody help me? Any other tool or scripting language (perl, python, sed, zsh, ...) would also be accepted.

Thanks a lot!

Georg P.
  • 2,785
  • 2
  • 27
  • 53
  • 2
    Have you tried `xxd`? http://stackoverflow.com/questions/7826526/transform-a-hex-info-to-binary-using-linux-command http://linux.die.net/man/1/xxd – xxfelixxx Sep 14 '15 at 10:46
  • perl has `pack` http://perldoc.perl.org/functions/pack.html which is useful for just that kind of conversion – bytepusher Sep 14 '15 at 10:51
  • Amazing! I knew `xxd` before, but didn't know it can also reverse hex dumps. Thanks a lot! – Georg P. Sep 14 '15 at 11:03

0 Answers0