counting in awk
#!/bin/sh
find $开发者_如何学Go{*-.} -type f -print | xargs file |
awk '{
$1=NULL;
t[$0]++;
}
end {
for (i in t) printf("%d\t%s\n", t[i], i);
}' | sort -nr
The first "find" line works. But the awk part does not work. I expect the count of file types sorted in descending order.
awk is case sensitive - "end" should be "END"
Use END
, not end
.
Try to add a blank between the tick and the {
:
awk ' {
Some versions of AWK need this.
精彩评论