I want to ask how to delete repeated lines in vim.For now, I have a file which contained 12740 lines. There are only 98 unique lines, and each line is duplicated 129 times.I have tried:g/^\(.*\)$\n\1$/dBut my problem is, some unique lines are the same to each other, I don't know which lines are those.When I input that command, my file becomes 95 lines, not 98 which I want. (3 lines are the same to each other, I guess, so it's also deleted).Any other solution?I'll edit if my question is still not clear enough.My file:-0.00697568 - line 1-0.00697568 - line 2...0.00697568  - line 1310.00697568  - line 1320.00697568  - line 133...0.020909881 - line 2610.020909881 - line 262...  And so on.I need to keep the 130n+1 line, from n=0 until n=97.Edit I need the lines to keep their order so a solution sorting the lines would not be an acceptable one.
delete repeated line in vim, keep the n-th line in Vim
regular expression;normal mode
To delete n lines starting from every line, you can do::%norm nddFor example, if I started with the numbers 1 to 10 repeated 5 times:1111122222333334444455555666667777788888999991010101010And I do::%norm 4ddI get:12345678910So, try :%norm 129dd.This is one of those instances where you want :% instead of :g. :g tags the lines so that modifications while running the g command aren't counted for running the remaining iterations. %, on the other hand, will run from every line from 1 to the end, and it will only look at the current line numbers at each iteration.