Showing posts from February, 2010

Sorting numbers - VIM

" This will sort a list of numbers in ascending order :sort n " Adding a bang after sort will cause the list to be sorted in descending order :sort! n

Removing duplicated lines - VIM

It is a good way to compare to list and see what you have left to do. First sort your list then, find lines that duplicate and replace with a blank space, strip empty lines and wallah. an clean list of what you have left. :sort | %s/^\(.*\)$\n\1$// | v/./d

I was inspired by : Uniq - Removing duplicate lines - Vim Tips Wiki: "g/^\(.*\)$\n\1$/d"