Community
    • Login

    Creating a tally count of line duplicates

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 2.2k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors