sort -n 不起作用?

sort -n 不起作用?

我正在做一件平常的事情sort -n,但这次它不适用于以下输入列表,部分类似于

./firedock-output_308.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 54.06
./firedock-output_286.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.91
./firedock-output_26.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.86
./firedock-output_7.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 24.29
./firedock-output_843.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.88
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42

之后的输出sort -k1,1n

./firedock-output_1000.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 95.86
./firedock-output_100.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_101.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 33.89
./firedock-output_102.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.83
./firedock-output_103.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.69
./firedock-output_104.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 69.43
./firedock-output_105.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 25.11
./firedock-output_106.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.46
./firedock-output_107.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 41.77
./firedock-output_108.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.61
./firedock-output_109.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 72.75
./firedock-output_10.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 67.79
./firedock-output_110.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 13.87
./firedock-output_111.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.44
./firedock-output_112.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 27.03
./firedock-output_113.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 37.43
./firedock-output_114.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.57
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
./firedock-output_116.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 57.75
./firedock-output_117.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 21.21

在这种情况下,为什么sort -n不能像通常那样工作(即根据数字顺序排序)?

我想要的是

./firedock-output_1.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_2.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_3.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_4.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62

直到1000(总共有1000行)。

谢谢。

答案1

好的,解决了。我需要指定排序键的位置,即第 19 个字符。

sort -n -k1.19

多谢!

相关内容