UNIX sort with exponential values? UNIX sort with exponential values? unix unix

UNIX sort with exponential values?


sort with '-g' option should do the trick for you.-g option indicates 'use generic numerical value' for sorting


Please note, that your locale may assume another delimiter:For example, in russian localization ',' character delimits parts of number rather than '.'. In this case you should take into account the LANG variable.

In my case LANG was set to ru_RU.KOI8-R and so sort -g gave me wrong result.


So - just to give an example for those who do not know how to use it: instead of "-n" you use "-g".l = 1,0.3,6.01e-10

sort -t$',' -n example.txt

0.316.01e-10

sort -t$',' -g example.txt

6.01e-100.31