What happened here is I grouped together lines having the same values for columns 1,2,3,5,6 and selected only the line with the smallest value in the 4th column in every group.
I am currently managing this with a small PERL script. Is there a way to do this using shell utilities alone?
You are a man of few words ! Amazing!
My unix machine is down, and it will be a while before I can try this out. But now that I have seen it, I can tweak it, if I do run into any errors.
I made small change to the code posted by Ygor...and that will apply to solution by Aigles too (remember, my problem is reassigning $4 doesnt modify $0). Heres the changed code:
awk 'BEGIN{FS=":"}{str=""; for(j=1;j<=NF;++j) str=sprintf("%s%s",str,$j)} (v[str]=="")||(v[str]>$4){v[str]=$4;a[str]=$0}END{for(i in a)print a[i]}' file1
Here are the tweaks:
(1) Now I have a new variable "str" - this doesnt have the 4th column values
(2) In the condition part, now I check for (v[str]=="") instead of (!v[str]) --- the latter throws an error on my system.
Sorry...the corrected code is (missed the conditional in the for loop):
awk 'BEGIN{FS=":"}{str=""; for(j=1;j<=NF;++j) if(j!=4) str=sprintf("%s%s",str,$j)} (v[str]=="")||(v[str]>$4){v[str]=$4;a[str]=$0}END{for(i in a)print a[i]}' file1