[comp.unix.questions] Editing binaries

avr@mtgzz.att.com (a.v.reed) (10/14/88)

In article <2965@ci.sei.cmu.edu>, pdb@sei.cmu.edu (Patrick Barron) writes:
> Or, you could always use my favorite solution - just crank up emacs
> (or whatever your favorite editor is, but not ed or ex/edit/vi, 'cause
> they can't do this), and change it in the binary.

BULLSHIT. I edit binary files with vi all the time. Just read them in with
:r !od -c file
and write them out, after editing, with
:w !rod -c >file
which is a piece of cake. So please don't tell me I can't do something just
because YOU don't know how. Some of us use tools, you know.

					Adam Reed (avr@mtgzz.ATT.COM)

jgy@hropus.UUCP (John Young) (10/14/88)

Adam Reed writes>
>
>In article <2965@ci.sei.cmu.edu>, pdb@sei.cmu.edu (Patrick Barron) writes:
>> Or, you could always use my favorite solution - just crank up emacs
>> (or whatever your favorite editor is, but not ed or ex/edit/vi, 'cause
>> they can't do this), and change it in the binary.
>
>BULLSHIT. I edit binary files with vi all the time. Just read them in with
>:r !od -c file
>and write them out, after editing, with
>:w !rod -c >file
>which is a piece of cake. So please don't tell me I can't do something just
>because YOU don't know how. Some of us use tools, you know.
>
>					Adam Reed (avr@mtgzz.ATT.COM)

So pdb's statement is correct, vi cannot edit a binary file.
All you do (most helpfully) is point out that one can convert binary
to ascii (though not with vi) and back again (though not with vi).

Watch your language.

John Young

pdb@sei.cmu.edu (Patrick Barron) (10/14/88)

In article <4596@mtgzz.att.com> avr@mtgzz.att.com (a.v.reed) writes:
>[...] Just read them in with
>:r !od -c file
>and write them out, after editing, with
>:w !rod -c >file
>which is a piece of cake. So please don't tell me I can't do something just
>because YOU don't know how. Some of us use tools, you know.

And please don't assume that we all have whatever tools you have.  Where
do I get this "rod" command (which I assume is "reverse octal dump")?  It
doesn't exist on 4.3BSD, Ultrix 2.2, or my Unix PC (under Unix 3.51) at home.

--Pat.

ebh@argon.UUCP (Ed Horch) (10/15/88)

In article <4596@mtgzz.att.com> avr@mtgzz.att.com (a.v.reed) writes:
>I edit binary files with vi all the time. Just read them in with
>:r !od -c file
>and write them out, after editing, with
>:w !rod -c >file
>which is a piece of cake.

That's real neat.  What if you don't *have* "rod"?  That's sort of like
telling someone trying to get a Hayes modem to work with an old uucp to
use HDB.  I try to have all the tools my users want on this system,
but I don't have everything, and some things I can't get at all.
I'm still looking for a uucp-able Kermit 4E, and wishing for the newer
grading features in HDB, for example.

>Some of us use tools, you know.

As most of us would like to.  So don't flame someone for not using
something they may not have or even be able to get, ok?

-Ed

fred@oravax.UUCP (Charles Mills) (10/18/88)

In article <323@argon.UUCP> ebh@argon.UUCP (Ed Horch) writes:
>In article <4596@mtgzz.att.com> avr@mtgzz.att.com (a.v.reed) writes:
>>:w !rod -c >file
>>which is a piece of cake.
>
>That's real neat.  What if you don't *have* "rod"?

Well, evidently a whole lot of people don't have "rod"; I admit I'm such
a person myself.  But I want it--- is it free?  Can someone send me one?

If it's not free I suppose making one wouldn't be that much of a challenge...
if you are rodless, maybe if you ask me in 2 or 3 months (my desk is
pretty full) I'll be able to send you one.

fred

gore@eecs.nwu.edu (Jacob Gore) (10/18/88)

/ comp.unix.questions / avr@mtgzz.att.com (a.v.reed) / Oct 13, 1988 /
>[...] I edit binary files with vi all the time. Just read them in with
>:r !od -c file
>and write them out, after editing, with
>:w !rod -c >file
>which is a piece of cake. [...]

And if you don't have rod, or if you think using it is just too easy, you
can just use
	:r !uuencode file
and
	:w !uudecode
instead.


Jacob Gore				Gore@EECS.NWU.Edu
Northwestern Univ., EECS Dept.		{oddjob,gargoyle,att}!nucsrl!gore

Yeah, yeah, it's a joke.

mike@nexus.UU.NET (Mike Hickey) (10/18/88)

    Has anyone considered snarfing bpatch from the archives? Should compile
on most boxes (runs on our NCR Towers && generic 386s w/Xenix)...

pss@unh.UUCP (Paul S. Sawyer) (10/21/88)

In article <2966@ci.sei.cmu.edu>, pdb@sei.cmu.edu (Patrick Barron) writes:
> In article <4596@mtgzz.att.com> avr@mtgzz.att.com (a.v.reed) writes:
> >[...] Just read them in with
> >:r !od -c file
> >and write them out, after editing, with
> >:w !rod -c >file
> >which is a piece of cake. So please don't tell me I can't do something just
> >because YOU don't know how. Some of us use tools, you know.
> 
> And please don't assume that we all have whatever tools you have.  Where
> do I get this "rod" command (which I assume is "reverse octal dump")?  It
> doesn't exist on 4.3BSD, Ultrix 2.2, or my Unix PC (under Unix 3.51) at home.
> 
> --Pat.


Nor, on my AT&T Unix 2.1.2...  Interesting that Mr. Reed speaks to us in such
a helpful manner from the company that, since they first provided my Unix O.S.,
has taken away from me, via upgrades and policy changes, such USEFUL UNIX 
TOOLS as NROFF and DIRECT E-MAIL to themselves...  And who hardwired /usr/mail
in the first place...

Yes, I could write ROD;  an aquaintance was speaking to me recently (but 
before this topic came up) about just such an approach, even to using the
od -c output to start with.  But I guess I really should buy the OCTAL DUMP
READER'S WORKBENCH...   8-)

In the spirit of UNIX TOOLS and the NEWS, etc, Mr. Reed, couldn't your posting 
have been more like:

  "In VI, I use ':r! od -c file', edit the resulting octal representation, 
  then 'w: !rod -c >file'.  ROD is a useful utility from --- which reads OD
  output back to binary form...."

Please don't cast stones - - you may break our remaining tools!

-- 
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Paul S. Sawyer              uunet!unh!unhtel!paul     paul@unhtel.UUCP
UNH Telecommunications
Durham, NH  03824-3523      VOX: 603-862-3262         FAX: 603-862-2030

croes@imec.uucp (Kris Croes) (10/21/88)

In article <3680040@eecs.nwu.edu> gore@eecs.nwu.edu (Jacob Gore) writes:
>/ comp.unix.questions / avr@mtgzz.att.com (a.v.reed) / Oct 13, 1988 /
>And if you don't have rod, or if you think using it is just too easy, you
>can just use
>	:r !uuencode file
>and
>	:w !uudecode
>instead.
>
I do usually use ``crypt'' instead of uuen/decode  :-)

Now the serious part:
  Despites all flames, I think the od/rod method is quite nice. 
  Therefor, the question if someone could post the code for `rod'.
  If no one does, I'll write my own.

Kris

-- 
--------
K. CROES - IMEC - Leuven - Belgium   ..!prlb2!imec!croes

The Demon King sends a "rm -r /" to your shell.

barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) (10/24/88)

In article <527@imec.UUCP>, croes@imec (Kris Croes) writes:
>  Despites all flames, I think the od/rod method is quite nice. 
>  Therefor, the question if someone could post the code for `rod'.
>  If no one does, I'll write my own.

I posted a program I got from net.sources three years ago to alt.sources.
It is called "unod" and was written by Daniel R. Levy.
-- 
Bruce Barnett