GNU grep 2.5.1 has the -o option to output only the matched text. Your grep doesn't.
As for counting...
E:\tmp>ls | grep -oE "\.\w+$" | sort -u | wc -l 12
In reply to Re^3: Counting the Extensions of the Directory
by EdwardG
in thread Counting the Extensions of the Directory
by Mago
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |