Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Creating a tally count of line duplicates

    Help wanted · · · – – – · · ·
    2
    3
    74
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • a-raccoon
      a-raccoon last edited by

      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
      
      Terry R 1 Reply Last reply Reply Quote 0
      • Terry R
        Terry R @a-raccoon last edited by

        @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

        a-raccoon 1 Reply Last reply Reply Quote 1
        • a-raccoon
          a-raccoon @Terry R last edited by

          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 like editor.research('^.*$', match_found) to perform a histogram by line.

          Much appreciated.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors