Community
    • Login

    Creating a tally count of line duplicates

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.5k Views
    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-raccoonA
      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 RT 1 Reply Last reply Reply Quote 0
      • Terry RT
        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-raccoonA 1 Reply Last reply Reply Quote 1
        • a-raccoonA
          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
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors