I want to show this kind of statistics about a particular directory:
$ myscript.sh
.c 34265 files
.h 17866 files
.cbl 1804 files
.pco 389 files
[...]
Is there a tool that can do this?
Here is my attempt:
find . -name "*.*" | sed -e "s/.*\.//g" | sort -u
And then I could type for each type find . -name "*.pc" | wc -l
but it is bothersome so I wrote:
find . -name "*.*" | sed -e "s/.*\.//g" | sort -u |\
xargs find . -name "*.{}" | wc -l
Unfortunately I must be missing something because it says:
find: paths must precede expression: as
("as" is the first extension)
Any idea what is going wrong?
Is there already a tool that does what I want (a tool counting file lines would be OK too).