Delete every other line in notepad++

前端 未结 6 2002
既然无缘
既然无缘 2020-12-12 15:05

Is there a way in Notepad++ to delete every other or nth line? I have a massive list of data and I need to reduce the size.

The data itself is not that important an

6条回答
  •  失恋的感觉
    2020-12-12 15:25

    I don't think there is a feature in Notepad++ that will automatically delete every other (or every nth) line, but if you wrote a short conversion program it would only take a few minutes.

    The pseudocode would look something like this:

    1. Create a StreamReader and StreamWriter (make sure you are not trying to read from
       and write to the same file)
    2. While (StreamReader is reading lines) increment i. You could mod it by whatever 
       number n you wanted in order to delete certain lines. Then have a conditional clause
       that would write out if i%n == 0 or whatever you specify.
    3. Close the program.
    

    That doesn't exactly answer your question, but I hope it helps.

提交回复
热议问题