I have a tabular file in which the first column has IDs and the second one has numeric values. I need to generate a file that contains only the line with the largest score for each ID.So, I want to take this:ES.001      2.33ES.001      1.39ES.001    119.55ES.001     14.55ES.073      0.35ES.073     17.95ES.140      1.14ES.140     53.88ES.140     18.28ES.178    150.27And generate this:ES.001    119.55ES.073     17.95ES.140     53.88ES.178    150.27Is there a way of doing this from a bash command-line?
Filtering the line with the largest value for a given ID
text processing;command line;numeric data
Depending on the type of data, sorting may take a long time.We can get the result without sorting (but using more memory) like this:awk 'a[$1]<$2{a[$1]=$2}END{for(i in a){print(i,a[i])}}' infile