/^@attribute/ { count() } function count() { if ($2 !~ "kloc") { arr[$2] = NF - 2 ++NUMATTR TOTAL += NF - 2 } } END { for (key in arr) print key"->"arr[key] print "Average values: "TOTAL / NUMATTR }