Sujet : Re: Need Help: Replace Bytes In Binary File
De : ff (at) *nospam* linux.rocks (Farley Flud)
Groupes : comp.os.linux.advocacyDate : 04. May 2025, 22:14:57
Autres entêtes
Organisation : UsenetExpress - www.usenetexpress.com
Message-ID : <pan$883eb$94630766$6fffee5$582c1c40@linux.rocks>
References : 1 2 3
On Sun, 04 May 2025 19:23:22 +0000, Farley Flud wrote:
On Sun, 4 May 2025 11:57:43 -0400, Chris Ahlstrom wrote:
This link has some ideas:
https://stackoverflow.com/questions/4783657/write-byte-at-address-hexedit-modify-binary-from-the-command-line
That does work on my files.
printf '\x49\x4e\x41\x52\x59' | dd of=$1 bs=1 seek=7 count=5 conv=notrunc
But the offset has to known beforehand and the replacement bytes
have to be entered manually. It's just as slow as using search and
replace with a hex editor.
>
For the record, I just discovered another program that is designed
to search/replace on binary files in the manner of sed:
https://sourceforge.net/projects/bbe-/I am very surprised that there are not more such utilities.
Bbe seems to have a bit of a learning curve. For now, I'll stick
to manual editing with Hexditor.
-- Systemd: solving all the problems that you never knew you had.