Creating a tally count of line duplicates
-
Hello, I am wondering if Notepad++ has the ability to not just remove duplicate lines, but also count them and generate a tally table. Here is a javascript website that does what I’m looking for, but I would love if NPP also had this capability.
fox fox dog cat fox cat fox
becomes
COUNT | LINE ----------------------------------------------------- 4 | fox 2 | cat 1 | dog ----------------------------------------------------- 7 | TOTAL LINES
-
@a-raccoon said in Creating a tally count of line duplicates:
but also count them and generate a tally table
There isn’t a native function within Notepad++, however a search through this forum found this post with a PythonScript program that with slight modification could do a line histograph. I note your example suggested your lines are in fact single words each on a different line, so if that’s the case then the program as it stands should work.
Its here.
Terry
-
Thanks for the find @terry-r, I’ll find that PythonScript plugin and play with it.
I assume I should be able to change the regex pattern to suit my needs in the line
editor.research('\w+', match_found)
to something likeeditor.research('^.*$', match_found)
to perform a histogram by line.Much appreciated.