-2

I have this table

gene  5   5  5
gene  4   4  3
gene  5   5  5
gene  1   4  5

and I would like to have the following,

gene  5   5  5   2
gene  4   4  3   1
gene  1   4  5   1

so in the last column I would have a number of similar rows (in this case it's gene 5 5 5, that is present two times in the original table, while others presented only once).

What would be the best approach to do it? Is it a job for awk? Actually, is it even possible in Linux?

0
$ sort data.txt|uniq -c|sed -e 's/[ ]*\([0-9]\)   \(.*\)$/\2 \1/'|sort -nrk 5
gene  5   5  5   2
gene  4   4  3   1
gene  1   4  5   1
|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.