bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10045: Unix od command, reverses hex bytes in output


From: Bob Proulx
Subject: bug#10045: Unix od command, reverses hex bytes in output
Date: Mon, 14 Nov 2011 13:32:30 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

address@hidden wrote:
> On Red Hat, the od command reverses the hex bytes.
> address@hidden PatientLoadDataFiles]$ cat a
> 123456
> address@hidden PatientLoadDataFiles]$ od -cx a
> 0000000   1   2   3   4   5   6  \n  \0
>         3231 3433 3635 000a
> 
> On HP-UX, it prints what you'd expect.
> plr02:lrxiusr:/plr02_users/lrxiusr/artdadamo> od -cx a
> 0000000    3132    3334    3536    0a00
>           1   2   3   4   5   6  \n
> 
> Is this a big-endian/little-endian issue?

Yes.  And also a misunderstanding of short integers.  Short integers
are two bytes.  With default printing they are printed in the default
endian format of the machine.  You probably wanted 'od -tcx1'.

Please see the FAQ reference for more details:

  The 'od -x' command prints bytes in the wrong order.
  
http://www.gnu.org/software/coreutils/faq/#The-_0027od-_002dx_0027-command-prints-bytes-in-the-wrong-order_002e

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]