od -tx1 old.bin
0000000 c8 00 00 00 55 01 00 00 dc 05 00 00 68 06 00 00
0000020
echo " c8 00 00 00 55 01 00 00 dc 05 00 00 68 06 00 00" | awk '{ gsub(" ","\s*"); print $0}'
\s*c8\s*00\s*00\s*00\s*55\s*01\s*00\s*00\s*dc\s*05\s*00\s*00\s*68\s*06\s*00\s*00
od -An -v -tx1 old.bin | sed -e 's/^\s*c8\s*00\s*00\s*00\s*55\s*01\s*00\s*00\s*dc\s*05\s*00\s*00\s*68\s*06\s*00\s*00/c8 00 00 00 55 01 00 00 dc 05 00 00 68 06 00 00 af/g' | xxd -r -ps - new.bin
od -tx1 new.bin
0000000 c8 00 00 00 55 01 00 00 dc 05 00 00 68 06 00 00
0000020 af
0000021
od -tx1 old.bin
0000000 00 00 00 00 00 00 00 00 e8 03 00 00 74 03 00 00
0000020 62 01
0000022
echo "123456789123456" > tmp.bin && od -An -tx1 tmp.bin | awk '{ gsub(" ","\s*"); print $0}'
\s*31\s*32\s*33\s*34\s*35\s*36\s*37\s*38\s*39\s*31\s*32\s*33\s*34\s*35\s*36\s*0a
od -An -v -tx1 tmp.bin | sed -e 's/^\s*31\s*32\s*33\s*34\s*35\s*36\s*37\s*38\s*39\s*31\s*32\s*33\s*34\s*35\s*36\s*0a/00 00 00 00 00 00 00 00 e8 03 00 00 74 03 00 00 47/g' | xxd -r -ps - new.bin
od -tx1 new.bin
0000000 00 00 00 00 00 00 00 00 e8 03 00 00 74 03 00 00
0000020 47
0000021
|