0

I am trying to remove duplicates by using Notepad++, but in previous versions there was a default way to do that and leave empty lines. Now it isn't helping, or I am missing something.

The whole idea is the following - when I have 1000 lines with duplicated text/links with code, I will select "Remove Duplicate Lines” option and I if all of my lines was duplicated I will see 500 lines. But I want to see 1000 rows and play with empty lines/rows.

In example I have identical lines of code like this:

href a 
href a 
href a 
href b 
href b

I want to achieve this:

href a 
empty line 
empty line 
empty line 
href b 
empty line

And using search and replace isn’t an option because there are 3k+ lines when unique lines are around 1k What I am missing here?

Empty lines are needed for me because I will manipulate with it after pasting to the csv file.

1 Answer 1

0

This can't be done in a single pass.
Here is a way to go but it needs the replace all key to be press as many times as needed.

  • Ctrl+F

  • Select "Mark" tab

  • Ctrl+M

  • Ctrl+H

  • Find what: ^(.+)$\R+\K\1

  • Replace with: LEAVE EMPTY

  • TICK Match case

  • TICK Wrap around

  • SELECT Regular expression

  • UNTICK . matches newline

  • Replace all

Explanation:

^           # beginning of line
(.+)        # group 1, 1 or more any character but newline
$           # end of line
\R+         # 1 or more any kind of linebreak
\K          # forget all we have seen until this position
\1          # backreference to group 1

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.