Deutsch   English   Français   Italiano  
<m7q5kdFhujlU2@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!npeer.as286.net!npeer-ng0.as286.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: vallor <vallor@cultnix.org>
Newsgroups: comp.os.linux.advocacy
Subject: Re: Need Help: Replace Bytes In Binary File
Date: 4 May 2025 21:47:57 GMT
Lines: 60
Message-ID: <m7q5kdFhujlU2@mid.individual.net>
References: <pan$def57$d367618d$5365ea3b$700171a@linux.rocks>
	<vv82pn$29efv$4@dont-email.me>
	<pan$469e9$5479b7cb$3265e5a7$145bcea7@linux.rocks>
	<pan$883eb$94630766$6fffee5$582c1c40@linux.rocks>
	<m7q555FhujlU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net w1n08p5LaHcbn5WGzLrrgQdD2T7cckfDlrwPm4Jwecm+5JYWhI
Cancel-Lock: sha1:oiH3GclWux5U+HJdKegLLbn8y4M= sha256:baRHGZ/qjNM1gQgNw4DhH7qrZDfnMuzjwXfmt/RwVQQ=
X-Face: +McU)#<-H?9lTb(Th!zR`EpVrp<0)1p5CmPu.kOscy8LRp_\u`:tW;dxPo./(fCl
 CaKku`)]}.V/"6rISCIDP`
User-Agent: Pan/0.162 (Hmm4; 7b109588; Linux-6.14.5)
Bytes: 2928

On 4 May 2025 21:39:49 GMT, vallor <vallor@cultnix.org> wrote in
<m7q555FhujlU1@mid.individual.net>:

> On Sun, 04 May 2025 21:14:57 +0000, Farley Flud <ff@linux.rocks> wrote
> in <pan$883eb$94630766$6fffee5$582c1c40@linux.rocks>:
> 
>> 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.
> 
> Thank you for suggesting bbe.
> 
> Incidentally:
> 
> $ apt-cache show bbe [...]
> Section: universe/editors Origin: Ubuntu [...]
>  _ _ _ _ _ _ _
> 
> There are examples in the info documentation.  For viewing it, I
> recommend pinfo(1), which is sort of like lynx(1) for info files

Ah, nevermind pinfo(1) -- it will fail an assertion:

pinfo: initializelinks.c:159: finddot: Assertion `closest>=str' 
failed.
Aborted (core dumped)

 ...when you browse to Invocating bbe > Commands

-- 
-v System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti
   OS: Linux 6.14.5 Release: Mint 22.1 Mem: 258G
   "Don't ask me. The cats are in charge around here."