aru*_*zhi 29 vi vim text-editor
可能重复:
如何在Vim中对数字和文字列进行排序
我必须根据线程ID对以下行进行排序.
Internal thread 0 bound to OS proc set {1}
Internal thread 1 bound to OS proc set {5}
Internal thread 2 bound to OS proc set {9}
Internal thread 10 bound to OS proc set {41}
Internal thread 9 bound to OS proc set {37}
Run Code Online (Sandbox Code Playgroud)
当我发布时,:!sort -n他们会像这样排序:
Internal thread 0 bound to OS proc set {1}
Internal thread 1 bound to OS proc set {5}
Internal thread 10 bound to OS proc set {41}
Internal thread 2 bound to OS proc set {9}
Internal thread 9 bound to OS proc set {37}
Run Code Online (Sandbox Code Playgroud)
但是我需要它们像这样排序:
Internal thread 0 bound to OS proc set {1}
Internal thread 1 bound to OS proc set {5}
Internal thread 2 bound to OS proc set {9}
Internal thread 9 bound to OS proc set {37}
Internal thread 10 bound to OS proc set {41}
Run Code Online (Sandbox Code Playgroud)
Nat*_*ate 44
只需使用Vim自己的排序功能.以视觉方式突出显示文本(或使用范围)并键入:
:sort n
文档可在此处获得:http://vim.wikia.com/wiki/Sort_lines
或者在Vim本身: :help sort
(编辑反映了破折号的重要澄清点以及对Vim自己的帮助文件的引用.)
| 归档时间: |
|
| 查看次数: |
16467 次 |
| 最近记录: |