Search code examples
text-editorvi

sort rows in 'VI' editor


If i have to sort following rows on the basis of values on left of '='. But the sorting should expand the selection to column after '=' simultaneously. Thtz is we dnt have to sort column after '=' ::

50599=1000000  
50454=00000054  
50080=00005464  
50098=00000875  
50661=00000665  
50788=10000035  
50988=10000006  
50994=10000656  
57009=00000005  
57022=10000008  
57040=10000005  
57000=10000005  
57060=10000089  
57067=10005640  
57102=00000765  
57190=00000867  

This needs to be done in 'VI' editing the file.

RESULT should be ::

50080=00005464    
50098=00000875  ...etc.

Solution

  • This answer is coming 2 years late, but might still be relevant, in visual mode select the block you want to sort and run:

    :!sort