(Same answer, but doesn't fit into a comment:)
I wanted to preview the file content before applying the patch I wanted; dd
uses different sets of arguments for input and output files, so remember to use if
and iseek
:
% dd if=somefile bs=1 iseek=4488884 count=12 conv=notrunc | hexdump -C
12+0 records in
12+0 records out
12 bytes copied, 0.000131 s, 91.6 kB/s
00000000 1f 04 00 71 40 02 00 54 a1 02 40 f9 |[email protected]..@.|
0000000c
And a multi-byte patch (dd
will just overwrite with whatever stdin gives it, so no need to specify length):
% printf '\x40\x02\x00\x54' | dd of=somefile bs=1 seek=4488888 conv=notrunc
4+0 records in
4+0 records out
4 bytes copied, 0.000251 s, 15.9 kB/s
somefile
end up truncated after the modified byte. – Confiteor