How to sort numeric and literal columns in Vim

Viewed 42714

Using Vim 6.0. Say I'm editing this file:

sdfsdg
dfgdfg

34     12
2      4
45     1
34     5

How do I sort the second column?

5 Answers

If more columns were there, you may use repetition to avoid complicated pattern.
For example, this will sort the entire file by the 100th column ("column" here means the space separated column)

:%sort /^\(\S\+\s\+\)\{99}/
Related