62705300019623531 0000009200AR000000027283 HILL , CLAY
62705300019623531 0000009200AR000000046485 HILL , CLAY
62705300019623531 0000009200AR000000027787 HILL, DORIS M

like on the file i post i have a huge file with different duplicate names, for example i want to delete the second line item for Hill Clay even the other numbers are not duplicate , i need only the first record (line Item) and remove the are lines that contain the same first and last name. In Excel i can highlights the column and remove duplicate,it is not working for me, even when I use mark all or RegRex place? maybe I am using wrong path or formula ? please advise!


This is not a task for an editor, although it could be done via (python) scripting of np++.

I would rather suggest using the awk interpreter (you can download native windows executable):

Create script.awk with content:

{ name=gensub(/^[0-9A-Z]+ [0-9A-Z]+ /, "", 1) }

$1 == oldnum && name==oldname {next}

{ print $0, oldnum=$1; oldname=name}

Then run

awk -f script.awk yourfile.txt > output.txt

And let's see how it's possible within np++ using the python scripting. Assuming that the Python Script plugin and the python interpreter is installed, you can write this code selecting Plugins->Python Script->New Script (the identation levels must be kept):

from Npp import *

content = editor.getText()
newcontent = ""

for line in content.splitlines():
    fields = line.split( None, 2)
    if fields[0] != oldnum or fields[2] != oldname:
        newcontent += line + "\n"
        oldnum = fields[0]
        oldname = fields[2]

editor.appendText( newcontent)

Just name it something like dedup.

Load your data file into a tab and within that tab, select Plugins->Python Scripts->Scripts->dedup ... and it should be ok now.

  • I just add Python, What is the formula that i would use for Notepad ++ under Python? not sure about Awk – Abou Feb 17 '16 at 16:07
  • Please , i do not want to install other software , what is the formula under Notepad++ ? thank you! the file is a TXT file. – Abou Feb 17 '16 at 16:24
  • Just hold the line. I do know about the python plugin for np++ but have never used it so takes some time to get acquainted. – Gombai Sándor Feb 17 '16 at 16:52
  • I learnt some tiny piece of the plugin. You can find the result at the end of the original answer. – Gombai Sándor Feb 17 '16 at 18:56
  • Nothing happened can you tell me step by step how to do it – Abou Feb 17 '16 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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