*BSD News Article 6768


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!network.ucsd.edu!sdd.hp.com!ncr-sd!crash!fpm
From: fpm@crash.cts.com (Frank Maclachlan)
Subject: Hex dump program like ISC's hd utility for 386BSD
Organization: CTS Network Services (crash, ctsnet), El Cajon, CA
Date: 19 Oct 92 00:12:40 PDT
Message-ID: <1992Oct19.001240.23484@crash>
Lines: 27

I missed the 'hd' hex dump program available under ISC and SCO Unix,
so I wrote the following shell script to produce similar output using
386BSD's 'hexdump' utility.  For those unfamiliar w/ hd's output, it
looks like this:

000000  0b 01 00 00 00 10 00 00  00 10 00 00 00 00 00 00   ................
000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   ................
*
001000  00 c0 00 c0 55 89 e5 53  8d 5d 04 8d 4b 04 89 ca   ....U..S.]..K...
001010  8b 02 83 c2 04 85 c0 75  f7 3b 11 72 03 83 c2 fc   .......u.;.r....
001020  89 15 24 10 00 00 52 51  ff 33 e8 51 00 00 00 50   ..$...RQ.3.Q...P
001030  e8 47 09 00 00 8d 65 fc  5b c9 c3 00 55 89 e5 c9   .G....e.[...U...
001040  c3 00 00 00 55 89 e5 c9  c3 00 00 00 40 28 23 29   ....U.......@(#)
001050  72 6f 6f 74 2e 63 20 31  2e 31 20 31 2f 32 31 2f   root.c 1.1 1/21/
001060  38 36 00 73 68 00 2f 62  69 6e 2f 73 68 00 72 6f   86.sh./bin/sh.ro
001070  6f 74 3a 20 63 61 6e 27  74 20 65 78 65 63 0a 00   ot: can't exec..

The shell script used to produce this output is:

#!/bin/sh
hexdump -e '"%06.6_Ax\n"' -e '"%06.6_ax  " 8/1 "%02x " "  " 8/1 "%02x "' \
	-e '"   " 16/1 "%_p" "\n"' $*

--
UUCP: {hplabs!hp-sdd ucsd nosc}!crash!fpm
ARPA: crash!fpm@nosc.mil
INET: fpm@crash.cts.com