How can I write a shell script to update one octet in binary file (like I do manualy with hexedit program) ?
- To: firstname.lastname@example.org
- Subject: How can I write a shell script to update one octet in binary file (like I do manualy with hexedit program) ?
- From: KLEIN Stéphane <email@example.com>
- Date: Tue, 2 Dec 2008 12:33:16 +0000 (UTC)
- Message-id: <firstname.lastname@example.org>
I need to update one octet in a binary file (it's disk image file raw).
To do that, I use hexedit and I do update manualy.
Now, I would like to script this task, I know address of octet to update
and the new value.
Do you know a tool to do that ?
I've tried :
echo "0xFF" | ascii2binary -b 16 | dd of=/tmp/out bs=1 count=1 seek=3
but the file is cutted after 4 octets.
I know how can I do it in Python or other script language but I search
one "shell" solution.
Note : my context is I would like to write a script to resize some
VirtualBox disk image.
Thanks for your help,