Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.advocacy > #689970

Re: Need Help: Replace Bytes In Binary File

From Farley Flud <ff@linux.rocks>
Subject Re: Need Help: Replace Bytes In Binary File
Newsgroups comp.os.linux.advocacy
References <pan$def57$d367618d$5365ea3b$700171a@linux.rocks> <vv82pn$29efv$4@dont-email.me>
Message-Id <pan$469e9$5479b7cb$3265e5a7$145bcea7@linux.rocks>
Date 2025-05-04 19:23 +0000
Organization UsenetExpress - www.usenetexpress.com

Show all headers | View raw


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.

Moreover, this method can only overwrite existing bytes and cannot insert
extra bytes at a given offset.

Incidentally, my fave hex editor is a java program called Hexditor:

http://flying.guy.chez-alice.fr/HexditorEn.php

Unlike all other GNU/Linux hex editors, Hexditor allows full insertion/
deletion anywhere in the file.

Another possibility is wxHexEditor:

https://www.wxhexeditor.org/home.php

But this software is still in beta for the past 8 years!

The author is correct though: "because there is no good hex editor for
Linux system."



-- 
Systemd: solving all the problems that you never knew you had.

Back to comp.os.linux.advocacy | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Need Help: Replace Bytes In Binary File Farley Flud <ff@linux.rocks> - 2025-05-04 15:32 +0000
  Re: Need Help: Replace Bytes In Binary File Chris Ahlstrom <OFeem1987@teleworm.us> - 2025-05-04 11:57 -0400
    Re: Need Help: Replace Bytes In Binary File Farley Flud <ff@linux.rocks> - 2025-05-04 19:23 +0000
      Re: Need Help: Replace Bytes In Binary File Farley Flud <ff@linux.rocks> - 2025-05-04 21:14 +0000
        Re: Need Help: Replace Bytes In Binary File vallor <vallor@cultnix.org> - 2025-05-04 21:39 +0000
          Re: Need Help: Replace Bytes In Binary File vallor <vallor@cultnix.org> - 2025-05-04 21:47 +0000
            Re: Need Help: Replace Bytes In Binary File % <pursent100@gmail.com> - 2025-05-04 17:16 -0700
            Re: Need Help: Replace Bytes In Binary File Farley Flud <ff@linux.rocks> - 2025-05-05 08:14 +0000
          Re: Need Help: Replace Bytes In Binary File % <pursent100@gmail.com> - 2025-05-04 17:15 -0700

csiph-web