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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"sort" words in each line and then "sort -u" all "new&q

Status
Not open for further replies.

unprophete

Technical User
Apr 9, 2010
31
DE

preffered ksh, GNU tools not available on the system.

example input data:

A1 A2
B3 B1
A2 A1
B1 B2
B3 B2
B2 B1

expected result:

A1 A2
B1 B2
B1 B3
B2 B3

 
awk '$1>$2{print $2,$1;next}{print $1,$2}' input | sort -u

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top