change specified byte in a hex file

Arthur Chance freebsd at qeng-ho.org
Mon Jun 3 09:48:22 UTC 2013


On 06/03/13 07:28, s m wrote:
> i want to change a specified byte in a hex file. i want to edit my file and
> change byte 0x28a content from 0x08 to 0x14.

Given your earlier posts about increasing the number of partitions from 
8 to 20 on a BSD labelled disk, this probably is not something you 
really want to do without further research to see if the label actually 
contains enough space for the metadata for 20 partitions. I believe it 
doesn't and you're liable to trash the file system on your 'a' partition 
if you just edit the byte. Alternatively newfs'ing your 'a' partition 
may destroy the metadata for partitions beyond 'h'. You really need to 
learn how to use gpart correctly, rather than randomly changing bytes on 
a disk.

However, there's nothing like burning your fingers playing with matches 
to teach you to respect fire, so ...

> i try to do it with hex-editor in windows but this file is too big and i
> can't transfer it to the other system. i think it should be done by some
> commands such as "dd" but i don't know how to use it.

Of course it can be done by dd. Use "man dd" to find out how to use it, 
that's what the manual pages are for, and it's better to read for 
yourself than have someone give you an incantation you don't understand.

Hint: look at the bs= and seek= options.

Extra hint: *after* you've checked the potential problem I've mentioned 
in the first paragraph, you might also want to use "man echo", "man 
builtin", "man sh" and "man csh" to understand the differences between 
the various versions of echo you have available.

-- 
In the dungeons of Mordor, Sauron bred Orcs with LOLcats to create a
new race of servants. Called Uruk-Oh-Hai in the Black Speech, they
were cruel and delighted in torturing spelling and grammar.

		_Lord of the Rings 2.0, the Web Edition_


More information about the freebsd-questions mailing list