perl -ne '$c[$_]++ for (unpack("C*")); END{printf( "%10d %02x\n",$c[$_], $_ ) for (0..255)}' #### (# of bytes) (byte value)