file=myfile
for class in alnum alpha blank cntrl digit graph lower print punct space upper xdigit
do
printf '%7s: %d\n' "$class" "$(tr -Cd "[:${class}:]" < "$file" | wc -m)"
done
ascii and word are not standard character classes and are bash specific. word is alnum plus underscore, and ascii is characters 0 to 127, so you can do:
printf '%7s: %d\n' word "$(tr -Cd "_[:alnum:]" < "$file" | wc -m)"
printf '%7s: %d\n' ascii "$(LC_ALL=C tr -cd '\0-\177' < "$file" | wc -c)"
(note that the GNU implementation of tr, as of coreutils-8.22, won't work with multi-byte characters).
On systems using the GNU libc at least, you can also run:
$ locale ctype-class-names
upper;lower;alpha;digit;xdigit;space;print;graph;blank;cntrl;punct;alnum;combining;combining_level3
To find out the list of character classes that are defined in your locale.