I have text file which has tab-delimited columns in following format:
fileName Type sc1 sc2 sc3 sc4 sc5 sc6
file1 abc 0 0.2 0 0 0 0
file1 xyz 0 0.8 0 0 0.8 0.2
file2 abc 0.5 0 0 0.1 0 0
file2 xyz 0 0 0 0.7 0.003 0.1
file3 abc 0.002 0 0 0 0.04 0
file3 xyz 0.5 0 0 0 0 0.3
.
.
First row is the header row.
sc1, sc2, sc3 etc are score 1, score 2, score 3 (they are not all zeros)
There are more than two types and each file has same number of types.
How to know the fileName which has lowest sc6 for xyz type?
or how to create another text file from this file, which will have filename and sc6 for all xyz type?
I really don’t want to load this as a db or do something like that. I was wondering if I can accomplish this rather quickly using Unix’s cut , sort or grep commands. Any perl, awk solution acceptable too.
Let me know if the question is not very clear.
P.S. Please feel free to suggest different heading for this question. This is the best I could come up with.
or:
To create a file with just filename and sc6 for all xyz: