• Login
Community
  • Login

How to delete duplicate lines ?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 Posters 457 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.
  • B
    bolapedia gg
    last edited by Feb 17, 2022, 11:09 AM

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

    for example
    1
    1
    2
    3
    3
    4
    4
    4

    result
    2

    A 1 Reply Last reply Feb 17, 2022, 12:48 PM Reply Quote 0
    • A
      Alan Kilborn @bolapedia gg
      last edited by Alan Kilborn Feb 17, 2022, 12:50 PM Feb 17, 2022, 12:48 PM

      @bolapedia-gg

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

      B 1 Reply Last reply Feb 17, 2022, 1:45 PM Reply Quote 1
      • B
        bolapedia gg @Alan Kilborn
        last edited by Feb 17, 2022, 1:45 PM

        @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

        A N 2 Replies Last reply Feb 17, 2022, 1:56 PM Reply Quote 0
        • A
          Alan Kilborn @bolapedia gg
          last edited by Feb 17, 2022, 1:56 PM

          @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
          • N
            Neil Schipper @bolapedia gg
            last edited by Feb 17, 2022, 1:58 PM

            @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).

            A B 2 Replies Last reply Feb 17, 2022, 2:05 PM Reply Quote 2
            • A
              Alan Kilborn @Neil Schipper
              last edited by Feb 17, 2022, 2:05 PM

              @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
              • B
                bolapedia gg @Neil Schipper
                last edited by Feb 18, 2022, 8:28 AM

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                1 out of 7
                • First post
                  1/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors