bash - sort -g not working as expected for exponential notation -


from awk script output list @ bottom of post, , i'd sort numerically on first column. since it's in exponential notation, tried sort -gk1,1, didn't work - output in listing.

what problem here? thought -g able handle exponential notation?

i have sort (gnu coreutils) 8.20 under ubuntu 13.04.

the data:

original output             "sorted" output 0.12000000e-07 2.27723e-26  0.10000000e-07 1.84556e-26 0.17000000e-07 3.4771e-26   0.10000000e-08 2.99263e-27 0.13000000e-07 2.50426e-26  0.11000000e-07 2.05792e-26 0.90000000e-08 1.64135e-26  0.12000000e-07 2.27723e-26 0.18000000e-07 3.73627e-26  0.13000000e-07 2.50426e-26 0.80000000e-08 1.44369e-26  0.14000000e-07 2.73749e-26 0.70000000e-08 1.25438e-26  0.15000000e-07 2.97754e-26 0.60000000e-08 1.07324e-26  0.16000000e-07 3.22419e-26 0.50000000e-08 9.01209e-27  0.17000000e-07 3.4771e-26 0.14000000e-07 2.73749e-26  0.18000000e-07 3.73627e-26 0.40000000e-08 7.37598e-27  0.19000000e-07 4.00053e-26 0.30000000e-08 5.8135e-27   0.20000000e-07 9.26608e-26 0.20000000e-08 4.36327e-27  0.20000000e-08 4.36327e-27 0.20000000e-07 9.26608e-26  0.30000000e-08 5.8135e-27 0.10000000e-08 2.99263e-27  0.40000000e-08 7.37598e-27 0.10000000e-07 1.84556e-26  0.50000000e-08 9.01209e-27 0.19000000e-07 4.00053e-26  0.60000000e-08 1.07324e-26 0.15000000e-07 2.97754e-26  0.70000000e-08 1.25438e-26 0.11000000e-07 2.05792e-26  0.80000000e-08 1.44369e-26 0.16000000e-07 3.22419e-26  0.90000000e-08 1.64135e-26 

and clarify: i've tried both

$ ./myscript.sh | sort -g 

and

$ ./myscript.sh > tempfile.txt $ sort -g tempfile.txt 

with same results - , looking @ temp file can verify there's nothing fishy - doubt it's related command.

i did sort -g file, got this:

0.10000000e-08 2.99263e-27 0.20000000e-08 4.36327e-27 0.30000000e-08 5.8135e-27  0.40000000e-08 7.37598e-27 0.50000000e-08 9.01209e-27 0.60000000e-08 1.07324e-26 0.70000000e-08 1.25438e-26 0.80000000e-08 1.44369e-26 0.90000000e-08 1.64135e-26 0.10000000e-07 1.84556e-26 0.11000000e-07 2.05792e-26 0.12000000e-07 2.27723e-26 0.13000000e-07 2.50426e-26 0.14000000e-07 2.73749e-26 0.15000000e-07 2.97754e-26 0.16000000e-07 3.22419e-26 0.17000000e-07 3.4771e-26  0.18000000e-07 3.73627e-26 0.19000000e-07 4.00053e-26 0.20000000e-07 9.26608e-26 

see pipe:

kent$  cat file original output            0.12000000e-07 2.27723e-26 0.17000000e-07 3.4771e-26  0.13000000e-07 2.50426e-26 0.90000000e-08 1.64135e-26 0.18000000e-07 3.73627e-26 0.80000000e-08 1.44369e-26 0.70000000e-08 1.25438e-26 0.60000000e-08 1.07324e-26 0.50000000e-08 9.01209e-27 0.14000000e-07 2.73749e-26 0.40000000e-08 7.37598e-27 0.30000000e-08 5.8135e-27  0.20000000e-08 4.36327e-27 0.20000000e-07 9.26608e-26 0.10000000e-08 2.99263e-27 0.10000000e-07 1.84556e-26 0.19000000e-07 4.00053e-26 0.15000000e-07 2.97754e-26 0.11000000e-07 2.05792e-26 0.16000000e-07 3.22419e-26  kent$  cat file|sort -g original output            0.10000000e-08 2.99263e-27 0.20000000e-08 4.36327e-27 0.30000000e-08 5.8135e-27  0.40000000e-08 7.37598e-27 0.50000000e-08 9.01209e-27 0.60000000e-08 1.07324e-26 0.70000000e-08 1.25438e-26 0.80000000e-08 1.44369e-26 0.90000000e-08 1.64135e-26 0.10000000e-07 1.84556e-26 0.11000000e-07 2.05792e-26 0.12000000e-07 2.27723e-26 0.13000000e-07 2.50426e-26 0.14000000e-07 2.73749e-26 0.15000000e-07 2.97754e-26 0.16000000e-07 3.22419e-26 0.17000000e-07 3.4771e-26  0.18000000e-07 3.73627e-26 0.19000000e-07 4.00053e-26 0.20000000e-07 9.26608e-26 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -