假如有这么一列数字(或数字开头的字符串),想要排序后输出。

nums.txt

1
2
3
55
23
5
7
90
25
18
44
121
309
88

直接使用 sort 并不能满足需求:

$ cat nums.txt | sort
1
121
18
2
23
25
3
309
44
5
55
7
88
90

应该使用 sort -n

$ cat nums.txt | sort -n
1
2
3
5
7
18
23
25
44
55
88
90
121
309