I am looking for a way in VIM to delete all lines that are duplicates and only leave unique lines that exist in the file. I would prefer a macro but a command or function would be great.
Say I have a file that has duplicate lines and some uniques:
1Apple 1Apple 2Peach 2Peach 2Peach 3Beer 4Banana 4Banana 4Banana
I want to delete all lines so that all that is left:
The one unique line that I REALLY want.
I use sort u all the time to get a unique list by deleting duplicates but I have times I just need the unique line in the file.
Any ideas how to handle this case in VIM?