Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print unique columns based on field matching 1

Status
Not open for further replies.

dironman62

Technical User
May 14, 2011
1
US
I have this file where lines 1 and 3 match but in reversed fields, same for lines 2 and 4.

U1 U2
U2 U3
U2 U1
U3 U2
U3 U4

Want to print out lines that don't match, regardless of field, like this.

U1 U2
U2 U3
U3 U4
 
I made a few assumptions about what you wanted, but this might get you started
Code:
!f1[$1,$2] && !f1[$2,$1] { f1[$1,$2]=1; print}

CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top