head -1 table > workingfile awk 'NR>1' table | sort -k1.1,1.10 -k2.1,2.10 -k 23.1,3.10 | \ awk '!arr[$2 $3]++' >> workingfile