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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 03-29-2008
radoulov's Avatar
radoulov radoulov is offline
addict
 

Join Date: Jan 2007
Location: Milan, Italy/Varna, Bulgaria
Posts: 1,432
Or even:

Code:
awk 'END { for (k in f2) {
    split(f2[k], t)
    print f2[k] > (((t[1] SUBSEP t[2] SUBSEP t[3]) in f1) ? "file5" : "file6")
    }
}
NR == FNR { f2[$1,$2,$3] = $0; next }
{ print > (($1 SUBSEP $2 SUBSEP $3) in f2 ? "file3" : "file4")  
f1[$1,$2,$3] = $0 }' file2 file1
Reply With Quote