Package: bsdmainutils
Version: 6.1.10
Severity: normal

The 'man hexdump' description of the '-e' option and its format strings
is rather obscure; though there are some examples for the '-f' option, 
there's none for '-e'.  No patch today -- some lively quotes, followed
by some useful '-e' examples.  Readers that don't like complaints
should please skip ahead to the examples.

Disgruntled users:

    Manual on How to Use the Hexdump Unix Utility
 
    Every time I go to use hexdump I find myself stumbling over 
    its bizarre argument format and ineffectual manual. 
    Because I look at binary files often I decided to work up 
    this page more for myself than anyone else....
    http://256.com/gray/docs/misc/hexdump_manual_how_to.html


    Need help with hexdump -e
    Date: 25 Oct 2004 10:45:08 -0700
        
    Can someone tell me where I can find *good* documentation for the
    hexdump command? I've been trying for the past half hour to
    understand the -e format string....
    http://www.dbforums.com/archive/index.php/t-1049742.html


    Incomprehensive Hexdump Man Page

    THE HEXDUMP MAN page, I find, is not the best written example of an
    applications manual. {...} WTF!? Near having a fury induced head
    explosion I resolved to Google. Seems that I'm not the only one having a
    hard time decoding the '-e' description {...} Eventually I found some
    indications that, to get the desired formatting, I should utilize some
    of the non-fprintf formatting options provided by hexdump. More man page
    decoding? No fucking way! Enough of this shit! Having wasted precious
    work time, I abandoned hexdump and put together a little Lua script that
    would do the hex dumping and format the output to fit my requirements. {...}
    http://monzool.net/blog/2008/02/18/incomprehensive-hexdump-man-page/


Examples (with thanks to the folks who wrote the above URLs):

    # hex bytes
    % echo hello | hexdump -v -e '/1 "%02X "' ; echo
    68 65 6C 6C 6F 0A 

    # same, with ASCII section
    % echo hello | hexdump -e '8/1 "%02X ""\t"" "' -e '8/1 "%c""\n"'
    68 65 6C 6C 6F 0A        hello

    # hex with preceding 'x'
    % echo hello | hexdump -v -e '"x" 1/1 "%02X" " "' ; echo
    x68 x65 x6C x6C x6F x0A 

    # one hex byte per line
    % echo hello | hexdump -v -e '/1 "%02X\n"'       
    68
    65
    6C
    6C
    6F
    0A

    # a table of byte#, hex, decimal, octal, ASCII
    % echo hello | hexdump -v  -e '/1  "%_ad#    "'   \
                               -e '/1    "%02X hex"'  \
                               -e '/1 " = %03i dec"'  \
                               -e '/1 " = %03o oct"'  \
                               -e '/1 " = _%c\_\n"'
    0#    68 hex = 104 dec = 150 oct = _h_
    1#    65 hex = 101 dec = 145 oct = _e_
    2#    6C hex = 108 dec = 154 oct = _l_
    3#    6C hex = 108 dec = 154 oct = _l_
    4#    6F hex = 111 dec = 157 oct = _o_
    5#    0A hex = 010 dec = 012 oct = _
    _

    # byte# & ASCII with control chars
    % echo hello | hexdump -v  -e '/1  "%_ad#  "' -e '/1 " _%_u\_\n"'
    0#   _h_
    1#   _e_
    2#   _l_
    3#   _l_
    4#   _o_
    5#   _lf_
    

Hope this helps...


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash

Versions of packages bsdmainutils depends on:
ii  bsdutils                  1:2.13.1.1-1   Basic utilities from 4.4BSD-Lite
ii  debianutils               2.30           Miscellaneous utilities specific t
ii  libc6                     2.7-12         GNU C Library: Shared libraries
ii  libncurses5               5.6+20080621-2 shared libraries for terminal hand

bsdmainutils recommends no packages.

-- debconf information excluded



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to