# this awk program gives frequency of occurance of all names in a field. { toend=$7; sep=" "; for(i=(7+1);i<=NF;i++) toend=toend sep $i ; ++sum[toend] } END {for (name in sum) print sum[name], name | "sort -n"} .