BEGIN {IGNORECASE=1; OFS=","} FNR==1 {Locs=0; Files++ } /@attribute/ { Got[$2]++ } END { for(A in Got) if (Got[A]>=Files) print A }