Reputation:
I need to know how to hex edit from a bash file. For example,
hedit 0x0 A
This would write A to offset 0x0
Upvotes: 2
Views: 2236
Reputation: 31484
You should be able to use dd
to overwrite parts of a file like this:
printf '\x0a' | dd of=filetopatch bs=1 seek=0 count=1 conv=notrunc
The meaning of the arguments are:
of=filetopatch
: the file to patch (the output file)bs=1
: change 1 byte at a timeseek=0
: move to offset 0 (decimal) before writingcount=1
: copy only 1 input blockconv=notrunc
: do not truncate the output after the editUpvotes: 1