I have a text file that has 255 lines and I want to delete/remove specific non-consecutive lines (lines 2, 4, 56, and 180 for example) regardless of their contents. I cannot use regular expression replace as I do not want to touch the other lines. I was thinking of a feature similar to Go To (CTRL + G) wherein I specify the lines and delete those lines, or perhaps a feature like Replace in lines so that I can replace the specific lines with nothing. Is there a way to do this in Notepad++?
1 Answer
You metionded to delete/remove specific non-consecutive lines regardless of their contents.
For these special lines in my opinion a regular expression or function makes sense only when you need to repeat this very often.
From comments above bookmarking by manually using Ctrl + G and Ctrl+F2 in combination is my recommendation too.
So you can quickly mark some lines by repeating the key sequence Ctrl+G, linenumber, Enter and Ctrl+F2 with the existing functionality.
Of course, for multiple use with the same lines, a macro can be recorded and executed.
As a further option, you should nevertheless use the functions on the Ctrl+M tab (e.g. Regular expression, Bookmark line, ...) for your needs.
2