http://www.perlmonks.org?node_id=516610


in reply to Re^2: Counting the Extensions of the Directory
in thread Counting the Extensions of the Directory

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