Issue
I want to process a CSV input file like the following :
a;b
b;c
b;a
c;d
x;y
d;c
and remove both duplicate lines defined by the rule : a;b
and b;a
are considered duplicate and therefore should be removed, the same rule applies to c;d
and d;c
they shoud be removed.
I tried to process file twice and use the condition NR==FNR
to figure which pass it is (first or second) but i can't figure out how to implement the test on the duplication rule i defined above.
please help me
Solution
$ awk -F';' '{ks[$0]; a[$2 FS $1]++} END{for(k in ks) if(!a[k]) print k}' file
x;y
b;c
Answered By - karakfa