Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Aug 2007 11:03:56 -0400
From:      "Rajarajan Rajamani" <r.rajamani@gmail.com>
To:        "Erik Osterholm" <freebsd-lists-erik@erikosterholm.org>,  "Jerry McAllister" <jerrymc@msu.edu>,  V.I.Victor <idmc_vivr@intgdev.com>, freebsd-questions@freebsd.org
Subject:   Re: Utility to change a byte in a binary file?
Message-ID:  <4af955a20708100803k6f7ed623yc1ac15b3214129d0@mail.gmail.com>
In-Reply-To: <20070810145253.GA85496@idoru.cepheid.org>
References:  <W896404648215141186691117@webmail30> <20070809220254.GA81490@gizmo.acns.msu.edu> <20070810145253.GA85496@idoru.cepheid.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 8/10/07, Erik Osterholm <freebsd-lists-erik@erikosterholm.org> wrote:
> On Thu, Aug 09, 2007 at 06:02:54PM -0400, Jerry McAllister wrote:
> > On Thu, Aug 09, 2007 at 08:25:17PM +0000, V.I.Victor wrote:
> >
> > >
> > > It sure seems that this should be simple, but my searches have only
> > > turned up inter-active hex/disk editors.  I'm probably "asking" wrong.
> > >
> > > I have a large binary file (>700 meg) and I know that there is a
> > > single wrong byte.  I also know it's exact location in the file.

> > ////jerry
>
> If you use vim, you can do this using vim and xxd:
>
> http://www.vim.org/htmldoc/usr_23.html#23.4
>

Using vim is one way to do it and in case you are not familiar with
vi/vim you can use xxd on the command line to change your binary file
into text, edit the byte you want to change (since you know the byte
to be changed) and reconvert back to binary.
% xxd infile outfile_txt
edit the outfile using your favorite editor (assuming it will take the big file)
% xxd -r outfile_txt fixed_infile

That should do it too.

Raj



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4af955a20708100803k6f7ed623yc1ac15b3214129d0>