$ sort -n -t, -k1,2 -u test.dat 1,1 2,1 Not what I expected.