adad...@us.imshealth.com wrote:
> On Red Hat, the od command reverses the hex bytes.
> [lrxdusr@cdtslrx122d PatientLoadDataFiles]$ cat a
> 123456
> [lrxdusr@cdtslrx122d 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