[nzlug] Find and replace within a binary file?
Philip Charles
philipc at copyleft.co.nz
Thu Jul 3 19:02:30 NZST 2008
On Thursday 03 July 2008, Karl. wrote:
> On Thu, Jul 03, 2008 at 11:13:57AM +1200, Simon wrote:
> > Hi There, Im trying to compile a driver and have these
> > instructions...
> >
> > Now copy lib/fcpci-lib.o to lib/f2pci-lib.o and replace all
> > occurences of "fcpci" in
> > f2pci-lib.o by "f2pci". (It's a binary file, so be careful)
> > Replace all occurences of __fcpci__ in src.drv/* by __f2pci__. (quite
> > many) In src.drv/defs.h, replace
> >
> > Im wondering if someone could assist me to do the find and replace
> > for the binary file. Im ok with the rest of it :)
>
> I'd try BBE - the man page says:
> "bbe - binary block editor.
> bbe is a sed-like editor for binary files. It performs binary
> transformations on the blocks of input stream."
>
> Look at http://bbe-.sourceforge.net/ or find it in Debian, and
> presumably Ubuntu.
>
> Karl.
I use mc's text editor for this kind of work as a matter of routine. mc
will save a binary without altering the original in any way, and it has
search and replace.
Caveat. The replacement string needs to be exactly the same length as the
original.
Phil.
--
Philip Charles; 39a Paterson Street, Abbotsford, Dunedin, New Zealand
+64 3 488 2818 Fax +64 3 488 2875 Mobile 027 663 4453
philipc at copyleft.co.nz - personal. info at copyleft.co.nz - business
More information about the NZLUG
mailing list