GNU bug report logs - #14656
od -cx

Previous Next

Package: coreutils;

Reported by: "VANDEMAN, MIKE" <mv2371 <at> att.com>

Date: Tue, 18 Jun 2013 18:21:01 UTC

Severity: normal

Tags: moreinfo, notabug

Merged with 14657

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 14656 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: "VANDEMAN, MIKE" <mv2371 <at> att.com>
Cc: 14656 <at> debbugs.gnu.org
Subject: Re: bug#14656: od -cx
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




This bug report was last modified 11 years and 343 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.