I\'m trying to use VIM to remove a duplicate line in an XML file I created. (I can\'t recreate the file because the ID numbers will change.)
The file looks something
It seems like the bash, python and perl methods would work but you are already in vim. So why not create a function like:
function! RemoveDuplicateLines()
let lines={}
let result=[]
for lineno in range(line('$'))
let line=getline(lineno+1)
if (!has_key(lines, line))
let lines[line] = 1
let result += [ line ]
endif
endfor
%d
call append(0, result)
d
endfunction