RSS | technovelty home | page of ian | ianw@ieee.org
More from the "things you'd learn if you read the manual"
department, although the manual as currently written is a little
esoteric on this feature of hexdump.
$ hexdump -e ' [iterations]/[byte_count] "[format string]" '
As you might guess, this means apply format string to
groups of byte_count bytes, iterations times.
Format string is like printf.
You can of course chain multiple formats together, or put them in a file. So say you needed to clag some binary data into a C array, a-la firmware for loading into a driver. You could use
$ hexdump -v -e '6/4 "0x%08x, "' -e '"\n"' ./dump
to get something that fits in 80 columns and is almost ready to go.
posted at: Tue, 13 Dec 2005 15:46 | in /linux/tips | permalink | add comment (1 others)

This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.