Subject: Re: bug#14656: od -cx

From: Bob Proulx <[email-masked]>
Date: Tue, 18 Jun 2013 12:59:36 -0600

tag 14656 + moreinfo
thanks

VANDEMAN, MIKE wrote:
> Why does od -cx display the characters backwards

Because as documented -x displays "2-byte units".  Also known as
"words".  And words are printed using the native machine endian
format.

You want -tx1.  This is an FAQ.  See the FAQ documentation for the
longer explanation.

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

See the online standards documentation.

  http://pubs.opengroup.org/onlinepubs/009695399/utilities/od.html

> and with no alignment between the character & the hex value?

Huh?  What are you talking about?

> V=56
> G=47
> ...
> 
> alpi104:
> 
> + print 'VG Name               appl_vg'
> 0000000   V   G       N   a   m   e
>         4756 4e20 6d61 2065 2020 2020 2020 2020
> 0000020                           a   p   p   l   _   v   g  \n
>         2020 2020 2020 7061 6c70 765f 0a67

Please say more.  Please include enough information to recreate this
case as a small standalone test case.  Please use "echo" with no
options and no escape sequences, or "printf" which is standard, or
describe what "print" is doing to the data here.

  $ echo 'VG Name               appl_vg' | od -c
  0000000   V   G       N   a   m   e                                    
  0000020                           a   p   p   l   _   v   g  \n

  $ echo 'VG Name               appl_vg' | od -x
  0000000 4756 4e20 6d61 2065 2020 2020 2020 2020
  0000020 2020 2020 2020 7061 6c70 765f 0a67

  $ echo 'VG Name               appl_vg' | od -cx
  0000000   V   G       N   a   m   e                                    
             4756    4e20    6d61    2065    2020    2020    2020    2020
  0000020                           a   p   p   l   _   v   g  \n
             2020    2020    2020    7061    6c70    765f    0a67

Looks okay to me.

  $ echo 'VG Name               appl_vg' | od -Ax -tx1z -v
  000000 56 47 20 4e 61 6d 65 20 20 20 20 20 20 20 20 20  >VG Name         <
  000010 20 20 20 20 20 20 61 70 70 6c 5f 76 67 0a        >      appl_vg.<

Bob