SUMMARY : binary file editing using standard tool ?

From: Vincent Detzel <accrosys_at_wanadoo.fr>
Date: Fri Sep 19 2003 - 08:06:02 EDT
How to edit binary without :
   - vim/xxd
   - perl
   - gnutools
   - (tr and sed are only for text data)

a solution is to use dd and echo as described by Paul below.

========================================================================
dd is the mother of all commands.  This might be painful, but it should work
(I've done something like this in a pinch as well--make sure you know 
where the
byte to change is because of endian issues).

(
     dd ifs=1 ofs=1 if=input_file count=SOME_NUMBER
     printf "%c",241
     dd ifs=1 ofs=1 if=input_file skip=`expr SOME_NUMBER + 1`
) > output_file
========================================================================

I guess with adb it should work also but I couldn't make it.

Thanks to : Bertrand, Charles, Alan, Darren, Anthony and Paul. :-)


ORIGINAL POST :

 > I found a very interesting problem yesterday. I had to modify a binary
 > file (replacing a '0' with '1') on a solaris 2.6 system.
 > The host was on a high secure net and could not have 3rd party product
 > installed.
 >
 > To change binary file, I use either vim/xxd or perl, unfortunately these
 > tools were not installed on this host.
 >
 > What other standard tools remain if I want, say, to change ".240" with
 > ".241" on a binary file ?
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Sep 19 08:05:59 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:19 EST