ebart ebart - 1 year ago 70
Bash Question

How to use hexdump to show charaters in different presentations at the same time

I am counting the number of characters of files and directory names of an entire directory.

find . -printf "%f/n" | sed 's/./&\n/g' | sort | uniq -c


    234 _
162 /
341 .
342 0
156 1
217 2
99 3

But I need also a list of decimal, hex and normal representation at the same time of the found characters:


066 0x42 'A'
090 0x5A 'Z'

I have tried
with different format options but this didn't work for me.

Can it be done with hexdump ?

Answer Source

Can it be done with hexdump?


find . -printf "%f/n" |
hexdump -v -e '/1 "%03o "' -e '/1 "0x%02X "' -e '/1 "%c\n"'

See examples at the end of the hexdump man page.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download