BEGIN {fn="";k=0;n=0} FILENAME!=fn {fn=FILENAME;++k} k==1 {for(i=1;i<=NF;++i) {a[n,i]=$i} ; ++n} k==2 {m=999999;t=0; for (j=0;j