I have a file where I'd like to check the content of 4 columns, the order can be reversed between couples of these columns, that means if the columns are a,b,c,d then they can appear also as c,d,a,b. So columns a,b and c,d are locked but can be swapped between each other.
I found a similar post here remove redundancy in a file based on two fields, using awk however the solution does not work at all
Even with just two columns
a;b
d;a
b;a
r;f
r;y
a;b
a;d
If I apply the solutions provided and given as correct I end up with duplicates
$ awk '!seen[$1,$2]++ && !seen[$2,$1]++' file
a;b
d;a
b;a
r;f
r;y
a;d
As you can see there's still a;b and b;a
Any suggestion to make this work, considering also there would be four columns, for example
Dallas;Texas;Berlin;Germany
Paris;France;Tokyo;Japan
Berlin;Germany;Dallas;Texas
Florence;Italy;Dublin;Ireland
Berlin;Germany;Texas;Dallas
Should give
Dallas;Texas;Berlin;Germany
Paris;France;Tokyo;Japan
Florence;Italy;Dublin;Ireland
Berlin;Germany;Texas;Dallas
Note that the last line should not be deleted because that's a different record, so a,b and c,d should be considered as locked couples, so a,b,c,d or c,d,a,b should be considered as a duplicate but not other cases.