Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Jun 2013 10:48:12 +0100
From:      Arthur Chance <freebsd@qeng-ho.org>
To:        s m <sam.gh1986@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: change specified byte in a hex file
Message-ID:  <51AC665C.5090505@qeng-ho.org>
In-Reply-To: <CAA_1SgECkODHZXd0J1UHabAnNRNkcCxeRz9hWNKK0WNgAV4Xbg@mail.gmail.com>
References:  <CAA_1SgECkODHZXd0J1UHabAnNRNkcCxeRz9hWNKK0WNgAV4Xbg@mail.gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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_



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?51AC665C.5090505>