用排序8.21排序科学数字

时间:2014-05-21 22:57:15

标签: linux sorting exponential

我需要按列3然后2然后1

对此文件进行排序
9.2500e-02 9.7500e-01 1.2500e-01 5.0521e+00
9.2500e-01 9.7500e-01 1.2500e-02 5.0259e+00
9.2500e-02 9.7500e-02 1.2500e-02 4.9924e+00
9.2500e-01 9.7500e-02 2.7500e-03 4.9657e+00
9.2500e-02 9.7500e-03 2.7500e-03 5.0267e+00
9.2500e-01 9.7500e-02 2.7500e-03 5.0003e+00

到目前为止,我正在使用sort(版本8.13)

sort -k 3,3g -k 2,2g -k 1,1g file

获取正确的输出:

9.2500e-02 9.7500e-03 2.7500e-03 5.0267e+00
9.2500e-01 9.7500e-02 2.7500e-03 4.9657e+00
9.2500e-01 9.7500e-02 2.7500e-03 5.0003e+00
9.2500e-02 9.7500e-02 1.2500e-02 4.9924e+00
9.2500e-01 9.7500e-01 1.2500e-02 5.0259e+00
9.2500e-02 9.7500e-01 1.2500e-01 5.0521e+00

由于我已经升级了系统(排序现在是版本8.21),上面的命令给了我

9.2500e-01 9.7500e-01 1.2500e-02 5.0259e+00
9.2500e-02 9.7500e-01 1.2500e-01 5.0521e+00
9.2500e-02 9.7500e-02 1.2500e-02 4.9924e+00
9.2500e-01 9.7500e-02 2.7500e-03 4.9657e+00
9.2500e-01 9.7500e-02 2.7500e-03 5.0003e+00
9.2500e-02 9.7500e-03 2.7500e-03 5.0267e+00

了解发生了什么以及如何做到这一点?

0 个答案:

没有答案