How to insert an offset to hexdump with xxd?
Solution 1
This is what I am doing now..It works perfectly but its kind of lame approach for just adding an offset :)
xxd file.bin | xxd -r -s 0x2e00000 | xxd -s 0x2e00000 > file.hex
Solution 2
xxd
now appears to come with offset support, using -o [offset]
for example: xxd -o 0x07d20000 file.bin
My version of xxd
on Gentoo Linux has it, but I dug deeper to help folks on other distros:
xxd V1.10 27oct98 by Juergen Weigert
-- Do not use the xxd version -- I have found this source code without the offset support!! So I tracked down where my binary comes from:
app-editors/vim-core-7.4.769
-- So apparently, as long as you have a modern VIM installed, you can reap the benefits of the added offset support; at least on Gentoo, but I'm steering you in the right direction.
If you find that your distro still ships an older xxd, considering manually compiling a newer VIM that you confirm has offset support.
Jean
Full time Plumber. I speak Malayalam. ആന പോകുന്ന പൂമരത്തിന്റെ ചോടെപോകുന്നതാരെടാ.. ആരാനുമല്ല കൂരാനുമല്ല കുഞ്ഞുണ്ണിമാഷും കുട്ട്യോളും - കുഞ്ഞുണ്ണിമാഷ് 7 out of 10 internet users don't know that Ad free browsing is possible https://adblockplus.org/
Updated on June 05, 2022Comments
-
Jean almost 2 years
Is there an easy way to add an offset to the hex dump generated by xxd ?
i.e instead of
0000: <data> 0004: <data> 0008: <data>
I should get
Offset+0000: <data> Offset+0004: <data> Offset+0008: <data>