How to modify binary file in Emac/vi

How to modify binary file in Emac/vi

Post by Datta Pati » Sat, 28 Feb 2004 23:14:15

Hi all ,

I have binary file(it looks like 101010100100001001001)
I have opened in hex mode(by giving ESC X--->hexl mode)
now it looks like (1ad3 89f0 0ba2.....)

Now i want to change to :
1ad3 89f0 0ba2 original file
2bd3 89f0 0ba2 new file(say)
but when i type 2 takes its asciii value & changes two bytes.What i
want is when i press 2 , its hexadecimal value(i.e. 2) insted of ascii value
should appear.

Is there any method to change one-nible value in emacs or vi .
Plz help ...its v imp & will save our lot of time.(Basically in above case
we r trying to corrupt data)
Note : input file is binary file.

Thanx lot in advance.

Regards/Mit freundlichen Gren,
Datta Patil

How to modify binary file in Emac/vi

Post by Bjoern Mil » Sat, 28 Feb 2004 23:33:46

"Datta Patil" < XXXX@XXXXX.COM > writes:

You can do that with `command hexl-insert-hex-char' which is bound
to C-M-x. For entering lots of digits this is probably a bit too
complicated, as you can only enter one byte at a time.

BTW., C-h m shows information about the current mode (in every
buffer), e.g. the hexl-mode in your case. And in this info you can
find things like the C-M-x command.


Bjoern Milcke mailto:Bjoern.Milcke'at'Sun.COM
Software Engineer
(Star|Open)Office Chart


How to modify binary file in Emac/vi

Post by fifo » Sat, 28 Feb 2004 23:59:32

There's also

M-x hexl-insert-hex-string RET

for inserting several characters at once.