I have a csv file with 7 fields of data. I want to sort the 7th field in reverse numerial order (smallest values first). The 7th field of data looks like this:
0.498469643137
1
6.98112003175e-10
9.11278069581e-06
I have tried to use the UNIX sort tool like this:
$ sort -t"," -n -k -r 7 <my_file>
The problem I am having is that sort does not recognize exponential form. For example, sort thinks 6.98112003175e-10
is larger than 1
. How can I use sort to sort a csv column, but recognize the scientific notation? Thanks in advance for the help.
sort with '-g' option should do the trick for you. -g option indicates 'use generic numerical value' for sorting