bug-coreutils
[Top][All Lists]
Advanced

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

Re: od -tx1|-tx2|-to1|-to2 output problem


From: Bob Proulx
Subject: Re: od -tx1|-tx2|-to1|-to2 output problem
Date: Thu, 16 Oct 2008 13:40:52 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Howland Craig D (Craig) wrote:
>      When using od with output formats of 1 or 2 bytes, the printed
> output can be wrong, particularly--but not exclusively--with
> non-printing characters.  Specifically, the output is sometimes
> printed as an asterisk ('*') instead of the regular output--the
> whole line being affected.

Does adding -v resolve your problem?  I think it is just what you are
looking for here.

  info coreutils 'od invocation'

  `-v'
  `--output-duplicates'
       Output consecutive lines that are identical.  By default, when two
       or more consecutive output lines would be identical, `od' outputs
       only the first line, and puts just an asterisk on the following
       line to indicate the elision.

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

  -v
    Write all input data. Without the -v option, any number of groups
    of output lines, which would be identical to the immediately
    preceding group of output lines (except for the byte offsets),
    shall be replaced with a line containing only an asterisk ( '*' ).

As it turns out the traditional legacy behavior of the original 'od'
program is to collapse "uninteresting" output into a "*" line.  That
is just the way that it has always been.  But you can turn it off.

> $ print -n '\0112\0106\0111\0106\0000\0001\0001\0000\0000\0001' | od -toC -w1

Thank you for the nice small example for discussion.  That was great!

Just fyi but note that 'print' isn't portable and 'print -n' even less
so.  ('echo' is okay for simple strings but is worse for escape
sequences.)  Use of the standard 'printf' is strongly encouraged when
printing escape characters.  It can be used portably.

>      Because I have seen identical results with two different
> versions on two different OSs, I am sending this to coreutils rather
> than to either of the two OS owners, as it sure seems to not be OS
> related.

Sure!  Hope this helps.

Bob




reply via email to

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