The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-26-2009
colemar colemar is offline
Registered User
  
 

Join Date: Apr 2009
Location: Trento, Italy
Posts: 116

Code:
join -o 1.2 0 2.2 -1 1 -2 1 file1 file1 | nawk '!a[$3$2$1];{a[$1$2$3]++}'

This may perform better (or not) with a large file1:


Code:
join -o 1.2 0 2.2 -1 1 -2 1 file1 file1 | nawk '$1<$3{print;next}{print$3,$2,$1}' | sort -u


Last edited by colemar; 05-26-2009 at 11:11 AM..