Sample Header Ad - 728x90

Why is od calculating decimal values wrong?

0 votes
1 answer
316 views
This question is related to the answer from enzotib to the question: https://unix.stackexchange.com/questions/88848/how-could-i-use-bash-to-find-2-bytes-in-a-binary-file-increase-their-values-an This converts the two bytes into its hex value: $ echo -n $'\x1b\x1f' | od -tx2 0000000 1f1b 0000002 But now, this should give me the decimal value: echo -n $'\x1b\x1f' | od -tu2 0000000 7963 0000002 But if I convert the hex value into decimal it should be $ printf "%d" 0x1b1f 6943 Why is that? Am I using od wrong for decimal output?
Asked by erik (17679 rep)
Aug 30, 2013, 09:48 PM
Last activity: Aug 30, 2013, 10:18 PM