Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a two lists of words, one per line, each list in a separate file and I need to do two things:

  1. Merge the two lists but excluding the duplicates.
  2. Remove all words, that are less than 5 characters long.

For example: First list:


Second list:


Merged list:


How to do this task with Notepad++?

share|improve this question
If possible, this will be extremely difficult to achieve with Notepad++. Is there any reason thy you cannot use something more sophisticated? – Dennis Nov 24 '11 at 16:19
up vote 4 down vote accepted


The easiest way to merge two files is to copy and paste. Notepad++ has no build-in file merging feature.

You can, however, install a plugin for this. See Combining files in Notepad++.

Another solution would be the command line's copy. See Need to combine lots of files in a directory

Replacing line breaks:

Removing duplicates will be trickier than removing short words since Notepad++'s search does not search over multiple lines at once, so we will have to convert the line breaks into something else.

To achieve this, you can perform an Extended replace, finding all \r\n (DOS line break) and replacing them by # (or any other character that does not appear in your list).

If the last line was not blank, append a # to the end of the resulting string.

Removing duplicates:

Now perform a Regular expression replace, finding all ([^#]+)#(.*#)\1# and replacing them by \1#\2.

If there were duplicates in a single file, you might have to do that more than once.

Removing words of 4 or less characters:

This one is easy. Just perform a Regular expression replace, finding all #.?.?.?.?# and replacing them by #.

Line breaks:

Now you can get rid of the line break hack. Just perform an Extended replace, finding all # and replacing them by \r\n.

Finally, delete the last line as it will be blank.

share|improve this answer
Clunky fun effective. – soandos Nov 24 '11 at 16:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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