0

This question is related to the answer from enzotib to the question: How could I use Bash to find 2 bytes in a binary file, increase their values, and replace?

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?

1 Answer 1

4

You're running od on a little-endian machine.

>>> 0x1f1b
7963

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .