version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
---- |
|
|
2 |
__NAME__ |
|
|
3 |
|
|
|
4 |
|
|
|
5 |
hexdump, hd - ASCII, decimal, hexadecimal, octal |
|
|
6 |
dump |
|
|
7 |
__SYNOPSIS__ |
|
|
8 |
|
|
|
9 |
|
|
|
10 |
hexdump [[-bcCdovx] [[-e format_string] [[-f format_file] [[-n |
|
|
11 |
length] [[-s skip] file ... |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
hd [[-bcdovx] [[-e format_string] [[-f format_file] [[-n length] |
|
|
15 |
[[-s skip] file ... |
|
|
16 |
__DESCRIPTION__ |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
The hexdump utility is a filter which displays the specified |
|
|
20 |
files, or the standard input, if no files are specified, in |
|
|
21 |
a user specified format. |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
The options are as follows: |
|
|
25 |
-b '' One-byte octal display''. Display the input offsetin hexadecimal, followed by sixteen space-sepa-rated, three column, zero-filled, bytes of inputdata, in octal, per line. |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
-c''One-byte character display''. Display the inputoffset in hexadecimal, followed by sixteenspace-separated, three column, space-filled,characters of input data per line.-C''Canonical hex+ASCII display''. Display the inputoffset in hexadecimal, followed by sixteenspace-separated, two column, hexadecimal bytes,followed by the same sixteen bytes in %_p formatenclosed in ``|'' characters.Calling the command hd implies this option.-d''Two-byte decimal display''. Display the input off-set in hexadecimal, followed by eight space-sepa-rated, five column, zero-filled, two-byte unitsof input data, in unsigned decimal, per line.-e format_stringSpecify a format string to be used for displayingdata.-f format_fileSpecify a file that contains one or more newlineseparated format strings. Empty lines and lineswhose first non-blank character is a hash mark(#) are ignored.-n lengthInterpret only length bytes of input.-o''Two-byte octal display''. Display the input offsetin hexadecimal, followed by eight space-sepa-rated, six column, zero-filled, two byte quanti-ties of input data, in octal, per line.-s offsetSkip offset bytes from the beginning of theinput. By default, offset is interpreted as adecimal number. With a leading 0x or 0X, offsetis interpreted as a hexadecimal number, other-wise, with a leading 0, offset is interpreted asan octal number. Appending the character b, k,or m to offset causes it to be interpreted as amultiple of 512, 1024, or 1048576, respectively. |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
-v |
|
|
32 |
The -v option causes hexdump to display all input data. |
|
|
33 |
Without the -v option, any number of groups of output lines, |
|
|
34 |
which would be identical to the immediately preceding group |
|
|
35 |
of output lines (except for the input offsets), are replaced |
|
|
36 |
with a line comprised of a single aster- isk. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
-x'' |
|
|
40 |
Two-byte hexadecimal display''. Display the input offset |
|
|
41 |
in hexadecimal, followed by eight, space separated, four |
|
|
42 |
column, zero-filled, two-byte quantities of input data, in |
|
|
43 |
hexadecimal, per line. |
|
|
44 |
|
|
|
45 |
|
|
|
46 |
For each input file, hexdump sequentially copies the input |
|
|
47 |
to standard output, transforming the data according to the |
|
|
48 |
format strings specified by the -e and -f options, in the |
|
|
49 |
order that they were specified. |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
__Formats__ |
|
|
53 |
A format string contains any number of format units, sepa- |
|
|
54 |
rated by whitespace. A format unit contains up to three |
|
|
55 |
items: an iteration count, a byte count, and a |
|
|
56 |
format. |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
The iteration count is an optional positive integer, which |
|
|
60 |
defaults to one. Each format is applied iteration count |
|
|
61 |
times. |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
The byte count is an optional positive integer. If speci- |
|
|
65 |
fied it defines the number of bytes to be interpreted by |
|
|
66 |
each iteration of the format. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
If an iteration count and/or a byte count is specified, a |
|
|
70 |
single slash must be placed after the iteration count and/or |
|
|
71 |
before the byte count to disambiguate them. Any whitespace |
|
|
72 |
before or after the slash is ignored. |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
The format is required and must be surrounded by double |
|
|
76 |
quote ( |
|
|
77 |
fprintf(3)), with |
|
|
78 |
the following excep- tions: |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
An asterisk () may not be used as a field width or |
|
|
82 |
precision. |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
A byte count or field precision ''is'' required for each |
|
|
86 |
``s'' conversion character (unlike the fprintf(3) |
|
|
87 |
default which prints the entire string if the precision is |
|
|
88 |
unspecified). |
|
|
89 |
|
|
|
90 |
|
|
|
91 |
The conversion characters ``h'', ``l'', ``n'', ``p'' and |
|
|
92 |
``q'' are not supported. |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
The single character escape sequences described in the C |
|
|
96 |
standard are supported: |
|
|
97 |
|
|
|
98 |
|
|
|
99 |
NUL 0 |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
Hexdump also supports the following additional conversion |
|
|
103 |
strings: |
|
|
104 |
_a[[dox] Display the input offset, cumulative across inputfiles, of the next byte to be displayed. Theappended characters d, o, and x specify the dis-play base as decimal, octal or hexadecimalrespectively. |
|
|
105 |
|
|
|
106 |
|
|
|
107 |
_A[[dox]Identical to the _a conversion string except thatit is only performed once, when all of the inputdata has been processed._cOutput characters in the default character set.Nonprinting characters are displayed in threecharacter, zero-padded octal, except for thoserepresentable by standard escape notation (seeabove), which are displayed as two characterstrings._pOutput characters in the default character set.Nonprinting characters are displayed as a single``.''._uOutput US ASCII characters, with the exceptionthat control characters are displayed using thefollowing, lower-case, names. Characters greaterthan 0xff, hexadecimal, are displayed as hexadec-imal strings.000 nul 001 soh 002 stx 003 etx 004 eot 005 enq |
|
|
108 |
006 ack 007 bel 008 bs 009 ht 00A lf 00B vt |
|
|
109 |
00C ff 00D cr 00E so 00F si 010 dle 011 dc1 |
|
|
110 |
012 dc2 013 dc3 014 dc4 015 nak 016 syn 017 etb |
|
|
111 |
018 can 019 em 01A sub 01B esc 01C fs 01D gs |
|
|
112 |
01E rs 01F us 0FF del |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
The default and supported byte counts for the conversion |
|
|
116 |
characters are as follows: |
|
|
117 |
%_c |
|
|
118 |
, %_p, %_u, %c One byte |
|
|
119 |
counts only. |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
%d, %i, %o, |
|
|
123 |
%u, %X, %x |
|
|
124 |
Four byte default, one, two and four byte counts supported. |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
%E, %e, %f, |
|
|
128 |
%G, %g |
|
|
129 |
Eight byte default, four byte counts supported. |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
The amount of data interpreted by each format string is the |
|
|
133 |
sum of the data required by each format unit, which is the |
|
|
134 |
iteration count times the byte count, or the iteration count |
|
|
135 |
times the number of bytes required by the format if the byte |
|
|
136 |
count is not specified. |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
The input is manipulated in ``blocks'', where a block is |
|
|
140 |
defined as the largest amount of data specified by any for- |
|
|
141 |
mat string. Format strings interpreting less than an input |
|
|
142 |
block's worth of data, whose last format unit both inter- |
|
|
143 |
prets some number of bytes and does not have a specified |
|
|
144 |
iteration count, have the iteration count incremented until |
|
|
145 |
the entire input block has been processed or there is not |
|
|
146 |
enough data remaining in the block to satisfy the format |
|
|
147 |
string. |
|
|
148 |
|
|
|
149 |
|
|
|
150 |
If, either as a result of user specification or hexdump mod- |
|
|
151 |
ifying the iteration count as described above, an iteration |
|
|
152 |
count is greater than one, no trailing whitespace characters |
|
|
153 |
are output during the last iteration. |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
It is an error to specify a byte count as well as multiple |
|
|
157 |
conversion characters or strings unless all but one of the |
|
|
158 |
conversion characters or strings is _a or _A. |
|
|
159 |
|
|
|
160 |
|
|
|
161 |
If, as a result of the specification of the -n option or |
|
|
162 |
end-of-file being reached, input data only partially satis- |
|
|
163 |
fies a format string, the input block is zero-padded suffi- |
|
|
164 |
ciently to display all available data (i.e. any format units |
|
|
165 |
overlapping the end of data will display some number of the |
|
|
166 |
zero bytes). |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
Further output by such format strings is replaced by an |
|
|
170 |
equivalent number of spaces. An equivalent number of spaces |
|
|
171 |
is defined as the number of spaces output by an s conversion |
|
|
172 |
character with the same field width and precision as the |
|
|
173 |
original conversion character or conversion string but with |
|
|
174 |
any ``+'', `` '', ``#'' conversion flag |
|
|
175 |
characters removed, and referencing a NULL |
|
|
176 |
string. |
|
|
177 |
|
|
|
178 |
|
|
|
179 |
If no format strings are specified, the default display is |
|
|
180 |
equivalent to specifying the -x option. |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
__DIAGNOSTICS__ |
|
|
184 |
__EXAMPLES__ |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
Display the input in perusal format: |
|
|
188 |
|
|
|
189 |
|
|
|
190 |
Implement the -x option: |
|
|
191 |
|
|
|
192 |
|
|
|
193 |
__SEE ALSO__ |
|
|
194 |
|
|
|
195 |
|
|
|
196 |
gdb(1) |
|
|
197 |
|
|
|
198 |
|
|
|
199 |
BSD April 18, 1994 1 |
|
|
200 |
---- |