Community
    • Login

    How to delete duplicate lines ?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 3 Posters 794 Views 2 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.
    • bolapedia ggB Offline
      bolapedia gg
      last edited by

      i am wondering how to delete duplicate lines in notepad++

      for example
      1
      1
      2
      3
      3
      4
      4
      4

      result
      2

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Online
        Alan Kilborn @bolapedia gg
        last edited by Alan Kilborn

        @bolapedia-gg

        find: ^(\d+)(\R\1)+\R
        replace: nothing
        search mode: regular expression

        bolapedia ggB 1 Reply Last reply Reply Quote 1
        • bolapedia ggB Offline
          bolapedia gg @Alan Kilborn
          last edited by

          @alan-kilborn
          its not worked, if i have many lines, 5 millions data
          i would like to delete duplicate data

          a
          a
          b
          c
          c
          c
          d
          d
          d
          d
          e
          f
          f
          g
          h
          h
          h

          result expected
          b
          e
          g

          Alan KilbornA Neil SchipperN 2 Replies Last reply Reply Quote 0
          • Alan KilbornA Online
            Alan Kilborn @bolapedia gg
            last edited by

            @bolapedia-gg said in How to delete duplicate lines ?:

            its not worked

            Did you try it on the data you originally supplied?

            1 Reply Last reply Reply Quote 2
            • Neil SchipperN Offline
              Neil Schipper @bolapedia gg
              last edited by

              @bolapedia-gg
              This regex does the transformation: (^.*?\R)\1+

              But first go to the end of the file and make sure there is one blank line at the end. (If this isn’t satisfactory I’m pretty sure there’s a way to fix that).

              Alan KilbornA bolapedia ggB 2 Replies Last reply Reply Quote 2
              • Alan KilbornA Online
                Alan Kilborn @Neil Schipper
                last edited by

                @neil-schipper said in How to delete duplicate lines ?:

                I’m pretty sure there’s a way to fix that).

                (?-s)^(.+)(?:\R\1)+(\R|\z)

                Use * instead of + if it is desired to remove duplicate contiguous empty lines.

                1 Reply Last reply Reply Quote 4
                • bolapedia ggB Offline
                  bolapedia gg @Neil Schipper
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0

                  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