Hi Stefan, I would do simple macro like this one (before starting recording macro place cursor on the first column of the first line you want to check): qa -- start recording macro 'a' y$ -- copy whole line j -- place the cursor one line down :,$g/ -- we want to delete every duplicate of copied line to the end of file so we do the global command <C-r>" -- this should paste the copied line /d<CR> -- and tell vim to delete these duplicate lines, <CR> means that you should press enter <C-o> -- place cursor back to the last place (the line below the checked line recently) q -- stop recording
and then 999@a should remove all duplicate lines. I tested it on simple file but I don't say this will be always correct. Just try it. Best Regards, Karol Samborski 2011/7/6 Stefan Klein <[email protected]>: > Hi vim users, > i got a longer SQL script with duplicate inserts :/ > I'd like to remove those without sorting the whole file. > It's possible to match the lines by a pattern. > One solution might be to insert the line number at the end of the line, > sort the file, > delete duplicate lines ignoring the linenumber, > move the line number to the start of the line, > sort, > remove the line number. > Is there a more simple way? > thanks, > Stefan > > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
