I've got 5 double values stored in binary file, in the following way:
perl -e "print pack('d5', (0.001, 0.002, 0.003, 0.004, 0.005))" > file.bin
and I'd like to change 5th value from 0.005
into 0.008
in the already existing file.
I'm aware that I can read the double by using GNU od
, like:
$ od -F -An -j32 -N8 file.bin | xargs
0.005
but how can I modify one of these values in a simple way in shell?
Does GNU od
has ability to change it, or I've to use other utilities (like xxd
), or I should use perl?