Community
    • Login

    How to delete all lines found in another txt document in notepad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.4k 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.
    • Peeyush MishraP
      Peeyush Mishra
      last edited by

      I have two files, name it as target file and source file. I want to delete all the entries in the target file which are present in the source file. How to achieve this in notepad++.

      Both target and source file have one column

      Couldn’t find anything similar

      Target File Content:
      9048019c-cf28-4f33-bc67-e18dc1facc40
      ef869420-2987-4e54-a1ea-3fe074b9a2cf
      12622407-a7b1-4cbb-b83f-0b9631422527
      824fb2cf-1c73-4f61-8687-6ccae090ffb5
      9048019c-cf28-4f33-bc67-e18dc1facc40
      07b433aa-c6d2-4699-809d-e094a20516be
      be103490-370b-407b-b507-28238aadf661
      824fb2cf-1c73-4f61-8687-6ccae090ffb5
      4137e7aa-6b2b-49b1-b2d8-38f862d7c5e1
      26844327-4b24-47d0-b421-0f2bedeba141
      be103490-370b-407b-b507-28238aadf661
      824fb2cf-1c73-4f61-8687-6ccae090ffb5
      4c00e75d-f862-4011-a3d8-1cecc74a8cc7
      a5bcaf38-413d-4ead-a5fb-1c75ecfe3b77
      26844327-4b24-47d0-b421-0f2bedeba141

      Source File Content
      12622407-a7b1-4cbb-b83f-0b9631422527
      07b433aa-c6d2-4699-809d-e094a20516be
      4137e7aa-6b2b-49b1-b2d8-38f862d7c5e1
      4c00e75d-f862-4011-a3d8-1cecc74a8cc7

      PeterJonesP 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Peeyush Mishra
        last edited by

        @Peeyush-Mishra ,

        Your question is similar to https://community.notepad-plus-plus.org/topic/11908/bookmarking-lines-containing-values-in-other-file and https://community.notepad-plus-plus.org/topic/20052/search-and-replace-between-2-files …

        Can you learn from those questions and figure out how to adapt those solutions to delete from your target file? (For example, in the “bookmarking” example, after “bookmarking” in the target file, you could delete the bookmarked lines using Search > Bookmark > Remove Bookmarked Lines; or with the search-and-replace, instead of replacing with some actual value, you could replace-with-empty, which is effectively deleting)

        I thought there were others, too; at some point in the past, I remember this being solved with PythonScript, but I haven’t found it yet.

        1 Reply Last reply Reply Quote 2
        • PeterJonesP
          PeterJones @Peeyush Mishra
          last edited by PeterJones

          @Peeyush-Mishra

          It’s still not the one with a PythonScript solution, but I found “Use Text File to Remove Lines” which I believe is exactly what you want to do. Pay attention to the caveats between the solutions given by @guy038 in that discussion and the ones from me – they each have their pros and cons.

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @PeterJones
            last edited by

            @PeterJones

            Here’s one that is very similar to this current question:

            https://community.notepad-plus-plus.org/topic/20443/deleting-numbers-from-list-1-that-also-appear-in-list-2

            A posting in that thread links to a PythonScript solution here:

            https://community.notepad-plus-plus.org/post/54316

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors