man hexdump可以发现关于-e format_string的解释,除了支持printf的convertion specifier外,还额外支持以下转换符号:
_a[dox] Display the input offset, cumulative across input files, of the next byte to be displayed. The appended char-
acters d, o, and x specify the display base as decimal, octal or hexadecimal respectively.
_A[dox] Identical to the _a conversion string except that it is only performed once, when all of the input data has
been processed.
_c Output characters in the default character set. Nonprinting characters are displayed in three character,
zero-padded octal, except for those representable by standard escape notation (see above), which are displayed
as two character strings.
_p Output characters in the default character set. Nonprinting characters are displayed as a single “.”.
_u Output US ASCII characters, with the exception that control characters are displayed using the following,
lower-case, names. Characters greater than 0xff, hexadecimal, are displayed as hexadecimal strings.
而printf的format格式是
[flag][field width][precision][length modifier][convertion specifier]
把"%06_ax " 16/1 "%02X " "\n"对号入座
%06_ax是flag为0,field width为6的_ax转换符。
%02X是flag为0,field width为2的X转换符。
16/1分别是hexdump的format unit的iteration count和byte count。
A format string contains any number of
format units, separated by whitespace.
A format unit contains up to three
items: an iteration count, a byte
count, and a format.