Try sort -k <your fields> | awk '{print $3, $1, $2}' | uniq -f2 -u | awk '{print $2, $3, $1}' sort -k <your fields> | awk '{print $3, $1, $2}' | uniq -f2 -u | awk '{print $2, $3, $1}' sort -k <your fields> | awk '{print $3, $1, $2}' | uniq -f2 -u | awk '{print $2, $3, $1}' delete all lines that are duplicated (without saving any copies). If you do not need the last field, change the first awk command to cut -f 1-5 -d ' ' , change the value of -f2 in uniq to -f1 and delete the second awk command.
source share