perl - Pick line with highest value -
referring code below:
how pick sample has highest value , output whole line.
sample value sequence mir1 23213 atatgcgctcg mir1 324235 atatctcgct mir1 3453 tctgctcg mir2 343 tctctgag mir2 34535 tctct mir2 4324 tctgagag ...
output:
mir1 324235 atatctcgct mir2 34535 tctct
i guess sorting in excel, there way in perl or in command line?
an awk
solution:
awk 'nr>1{ if (a[$1]<$2) {a[$1]=$2;b[a[$1]]=$0} else a[$1]} end {for (i in a) print b[a[i]]}' file mir1 324235 atatctcgct mir2 34535 tctct
Comments
Post a Comment