tags:

views:

59

answers:

3
#!/bin/sh
find ${*-.} -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.

+5  A: 

awk is case sensitive - "end" should be "END"

anon
A: 

Try to add a blank between the tick and the {:

awk ' {

Some versions of AWK need this.

Aaron Digulla
really? which versions?
glenn jackman
I remember this from HP-UX from 1992.
Aaron Digulla
A: 

Use END, not end.