Selecting lines based on the value in the 3rd column.

Hello,
I have a sample data like this:

A1 B1 100.00 
B1 A1 100.00 
A2 B2 90.80  
B2 A2 90.80  
A3 B3 99.07  
B3 A3 99.07  
A4 B4 99.00   
B4 A4 99.00   
A5 B5 97.13  
B5 A5 99.53  
.
.
Ax By  i
By Ax  j

each two lines are same comparison with opposite order. What I expected is that if the 3rd column value is the same, print the first only. If the value in the 3rd column is not equal, then print both line:

A1 B1 100.00
A2 B2 90.80
A3 B3 99.07
A4 B4 99.00
A5 B5 97.13  
B5 A5 99.53

How could I achieve this?

How about

awk 'K[$1,$2] != $3;  {K[$2,$1] = $3}' file
A1 B1 100.00 
A2 B2 90.80  
A3 B3 99.07  
A4 B4 99.00   
A5 B5 97.13  
B5 A5 99.53  
Ax By  i
By Ax  j
1 Like

That's great, thank you. could I ask you one more question? I am a beginner. so, How do I output the rest lines from this dataset? I mean reverse selection and output.

Try replacing the "not equal" comparison with the opposite.