Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

TextFX sort lines

Capum130
2012-01-03
2013-05-21
  • Capum130
    Capum130
    2012-01-03

    Hello, I was instructed by davegb3 to use TextFX to help me find duplicated strings (and remove the repeated term). It's a .txt file which contains a list of emails addresses sequenced and separated by comma.
    I need instructions for what he wrote below (it would be great if the list continues in sequence and separated by comma):

    TextFX sort lines (only unique) will do it easier than a script, assuming you don't mind if the order changes. If you need the order to stay the same, then you'd need to add each line to a list, if it wasn't already in the list, then write the list out at the end

    emails = []
     for line in range(0, editor.getLineCount()):
     em = editor.getLine(line).rstrip('\r\n ')
     if em not in emails:
     emails.append(em)
     notepad.new()
     editor.write("\r\n".join(emails))