unix 尝试对元素列表进行排序

hwamh0ep  于 2023-03-22  发布在  Unix
关注(0)|答案(1)|浏览(154)

我想按百分比对列表进行排序,但我做不到。我使用的命令是:
for alpha0 in $(seq 4 0.1 6) ; do echo -n "$alpha0: "; scripts/run_vad.sh $alpha0 | grep TOTAL; done | sort -t ':' -k 2 -n
在MacBook M1 Pro的终端中显示的内容是:“

4.1: ===> TOTAL: 89.120%
4.2: ===> TOTAL: 89.123%
4.3: ===> TOTAL: 89.151%
4.4: ===> TOTAL: 89.201%
4.5: ===> TOTAL: 89.222%
4.6: ===> TOTAL: 89.243%
4.7: ===> TOTAL: 89.265%
4.8: ===> TOTAL: 89.278%
4.9: ===> TOTAL: 89.291%
4: ===> TOTAL: 89.069%
5.1: ===> TOTAL: 89.305%
5.2: ===> TOTAL: 89.285%
5.3: ===> TOTAL: 89.276%
5.4: ===> TOTAL: 89.262%
5.5: ===> TOTAL: 89.246%
5.6: ===> TOTAL: 89.227%
5.7: ===> TOTAL: 89.175%
5.8: ===> TOTAL: 89.151%
5.9: ===> TOTAL: 89.136%
5: ===> TOTAL: 89.292%
6: ===> TOTAL: 89.100%'.

我不明白为什么不管用。
我试着对最后一列排序,这些数字都是百分比,我想问题可能是数字4,5和6没有小数点,但我不知道为什么它不工作。

ac1kyiln

ac1kyiln1#

如果使用:作为分隔符,则-k2从第二列开始,即它进行排序

===> TOTAL: 89.120%

从第三列开始,即-k3

相关问题