GNU bug report logs -
#41518
Bug in od?
Previous Next
Reported by: Yuan Cao <yuancao85 <at> gmail.com>
Date: Mon, 25 May 2020 05:56:02 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
Message #12 received at control <at> debbugs.gnu.org (full text, mbox):
tag 41518 notabug
close 41518
stop
response below...
On 25/05/2020 04:05, Yuan Cao wrote:
> Hello,
>
> I recently came across the following behavior.
>
> When using "--traditional x2" or "-x" option, it seems the order of hex
> code output for the characters is pairwise reversed (if that's the correct
> way of describing it).
>
> For example, using "od -cx" on a test file that contains "123456789\n", you
> get the following output:
>
> 0000000 1 2 3 4 5 6 7 8 9 0 \n
> 3231 3433 3635 3837 3039 000a
> 0000013
>
> It seems like it should be the following instead:
>
> 0000000 1 2 3 4 5 6 7 8 9 0 \n
> 3132 3334 3536 3738 3930 0a00
> 0000013
>
> The version involved is od in GNU coreutils 8.28.
That's because you're on a little endian machine.
If you want to reorder as per a big endian machine you can:
od --endian=big -cx your_file
If you want to hexdump independently of endianess you can:
od -Ax -tx1z -v
cheers,
Pádraig
This bug report was last modified 4 years and 360 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.