using bash: write bit representation of integer to file

前端 未结 9 923
春和景丽
春和景丽 2020-12-15 20:30

I have a file with binary data and I need to replace a few bytes in a certain position. I\'ve come up with the following to direct bash to the offset and show me that it fou

9条回答
  •  感情败类
    2020-12-15 21:12

    Worked like a treat. I used the following code to replace 4 bytes at byte 24 in little endian with two integers (1032 and 1920). The code does not truncate the file.

    echo -e \\x08\\x04\\x80\\x07 | dd of= obs=1 oseek=24 conv=block,notrunc cbs=4
    

    Thanks again.

提交回复
热议问题