La version ligne de commande :
-
find . -print|xargs file|awk ‘{$1= »";x[$0]++;}END{for(y in x)printf(« %d\t%s\n« ,x[y],y);}’|sort -nr
La version script :
-
#!/bin/sh
-
find . -print | xargs file |
-
awk ‘{
-
$1= »";
-
x[$0]++;
-
}
-
END {
-
for (y in x) printf(« %d\t%s\n« , x[y], y);
-
}’ | sort -nr
Ce qui aura pour effet d’afficher sur la console quelques chose comme ça :
9025 gzip (.gz) compressed data
2235 ascii text
2080 empty
16 directory
6 shell script – ksh (Korn shell)
3 data or International Language text
2 shell script – sh (default shell)
1 tar archive
1 compressed data block compressed 16 bit
1 c program text
1 PKZIP (.zip) compressed archive
2235 ascii text
2080 empty
16 directory
6 shell script – ksh (Korn shell)
3 data or International Language text
2 shell script – sh (default shell)
1 tar archive
1 compressed data block compressed 16 bit
1 c program text
1 PKZIP (.zip) compressed archive
0 Commentaires.