[英]linux sort not work correctly
I found cat not working correctly. 我发现猫无法正常工作。
>cat bbb.txt
1343,10360
1193,10424
337,10222
306,10518
209,10410
1954,4861
190,10101
1811,6134
173,10555
1725,6542
97,9596
50,9996
20,5049
15,6007
10,6400
I want to sort it with column1, numberic, so 我想用column1,numberic排序
>_ sort -t"," -k1 -nr bb.txt
1343,10360
1193,10424
337,10222
306,10518
209,10410
1954,4861
190,10101
1811,6134
173,10555
1725,6542
97,9596
50,9996
20,5049
15,6007
10,6400
If I replace all ',' with ';' 如果我将所有','替换为';' it works.
有用。 Is there a way to solve it?
有办法解决吗?
kent$ sort -nrt',' -k1,1 file
1954,4861
1811,6134
1725,6542
1343,10360
1193,10424
337,10222
306,10518
209,10410
190,10101
173,10555
97,9596
50,9996
20,5049
15,6007
10,6400
If you do sort -k1
, it sort from field1 till the end of the line. 如果您
sort -k1
进行sort -k1
,它将从field1到行尾进行排序。
read the KEYDEF
part of man sort
阅读
man sort
的KEYDEF
部分
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.