linux - Windows下的sort命令如何按值排序?
巴扎黑
巴扎黑 2017-04-17 13:51:56
0
1
806

大家知道在Linux下,我们在进行排序时可以用sort -n来按照key的数值进行排序而不是字符串值排序,那么在Windows下面有类似sort -n的指令吗,只知道Windows下的sort /r等同于Linux的sort -r.

巴扎黑
巴扎黑

reply all(1)
左手右手慢动作

Although it seems that my answer is too late, I still give you a similar method that you may have found.
You can use the sort-Object command in powershell to achieve this purpose.

λ type a.txt
1
10
2
3
5
8
90
11

After using type a.txt | sort-object -property {$_ -as [int]}:

λ type a.txt | sort-object -property {$_ -as [int]}
1
2
3
5
8
10
11
90
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template