Do you want to remove duplicates taking into account 1 2 and 2 1 so that they are the same?
< file.in \ | perl -lane'print "@F[ $F[0] < $F[1] ? (0,1,0,1) : (1,0,0,1) ]"' \ | sort -n \ | perl -lane'$t="@F[0,1]"; print "@F[2,3]" if $t ne $p; $p=$t;' \ > file.out
This can handle arbitrarily large files.
source share