Re: edit a binary file
From: Bill Thompson (bill.thompson_at_GOODYEAR.COM)
Date: 09/09/03
- Previous message: Bill Verzal: "Re: Mirroring question"
- Maybe in reply to: Arthur Prince: "edit a binary file"
- Next in thread: Renison, Rick: "Re: edit a binary file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 9 Sep 2003 15:38:49 -0400 To: aix-l@Princeton.EDU
Okay, nobody else bit on this so I'll give you *a* way to do it (probably
not the only way).
I have vim (http://www.vim.org) installed on all my computers. vim has a -b
option to allow you to directly edit binary files. Using vim with the -b
option in a "here to" notation would allow you to edit the file with a
script.
e.g.: Suppose you knew you wanted to change the characters at position
25-29 on line 5 of a binary file with the string "abcde". The following
script would do that.
#!/bin/sh
/usr/local/bin/vim -b /foo/bar/file <<END_OF_VIM
5G25|Rabcde^[:wq!
END_OF_VIM
However as I'm sure you know, changing a binary file is *very* dangerous.
Change them at your own risk
Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.
Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.
AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
----- Original Message -----
From: Arthur Prince
Newsgroups: bit.listserv.aix-l
To: aix-l@Princeton.EDU
Sent: Monday, September 08, 2003 6:57 AM
Subject: edit a binary file
I ned to be able to edit a binary file frfom a sheel script, i.e replace
one string with another. Can awk or sed or anything do this on a binary
file?
Message sent via Totalise Webmail - http://www.totalise.co.uk/
- Previous message: Bill Verzal: "Re: Mirroring question"
- Maybe in reply to: Arthur Prince: "edit a binary file"
- Next in thread: Renison, Rick: "Re: edit a binary file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|