Community
    • Login

    Search for a list of strings in another file.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 5 Posters 2.7k 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.
    • gendalvG
      gendalv
      last edited by gendalv

      • For each line in file1.txt a search input for search&replace box in file2.txt is made and removes it.

      Is there a simple way to do this or a plugin?

      Mark OlsonM Terry RT 2 Replies Last reply Reply Quote 0
      • Mark OlsonM
        Mark Olson @gendalv
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • Terry RT
          Terry R @gendalv
          last edited by

          @gendalv said in Search for a list of strings in another file.:

          Is there a simple way to do this or a plugin?

          This question has been put simply, but there isn’t a simple answer. It will depend on some things, not the least of which is the data. If each line that occurs in file1 is also a line in file2 then the obvious would be to combine both files, sort and delete duplicated lines. But as you have said very little about what your data. Maybe you dont want data sorted (there are methods to restore the original order).

          Perhaps read these 2 old posts which have a similar theme, come back with more information and be prepared to answer yet further questions. Please also read the pinned post Please Read This Before Posting before posting any additional information. Be aware that this and other FAQ posts are there to help you so that when you ask a question like this one you can include other information that may well be crucial in getting the correct solution provided.

          • Deleting numbers from LIST 1, that also appear in LIST 2

          • How to remove the content from file1 or list1 (e.g. 4000 usernames) from file2 or list2 (e.g. 50000 usernames)

          Terry

          gendalvG 1 Reply Last reply Reply Quote 2
          • gendalvG
            gendalv @Terry R
            last edited by

            @Terry-R deleting duplicated would leave the one occurrence behind for each duplicate found, it’s just merging that you’re suggesting, but I need to exclude(remove).

            Terry RT 1 Reply Last reply Reply Quote 0
            • guy038G
              guy038
              last edited by guy038

              Hello, @gendalv, @terry-r, @mark-olson and all,

              @gendalv, if I understand you correctly :

              • You have a File1.txt file

              • For each line of File1.txt, you want to verify that a specific pattern ( may be the whole line ) also exists in a second file file2.txt

              • And, in this case, you would like to delete the corresponding line in the File2.txt file ?


              On the other hand :

              • Could you tell us, the approximative size of your two files File1.txt and File2.txt ?

              • Could you tell us, the approximative number of lines of your two files File1.txt and File2.txt ?

              Best Regards

              guy038

              1 Reply Last reply Reply Quote 0
              • Terry RT
                Terry R @gendalv
                last edited by

                @gendalv said in Search for a list of strings in another file.:

                deleting duplicated would leave the one occurrence behind for each duplicate found

                Not necessarily. A regular expression will delete all/both copies.

                As I said, you haven’t provided much information so I’m not going to spend a lot of time explaining it in detail either.

                Terry

                gendalvG 1 Reply Last reply Reply Quote 1
                • gendalvG
                  gendalv @Terry R
                  last edited by gendalv

                  @Terry-R idk how to make compares like that with regex, seems way too complicated.

                  Anyway the “usernames” link above worked, although I had to figure out how to actually run a python script in np++, ended up installing PythonScript plugin, which is also not obvious, how to add a script to, but, after some fiddling, script by Scott Sumner works.
                  Although without regex in each line, but it’s better than manually doing it, just needs some prep.

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

                    @gendalv said in Search for a list of strings in another file.:

                    although I had to figure out how to actually run a python script in np++, ended up installing PythonScript plugin, which is also not obvious, how to add a script to, but, after some fiddling

                    You could have found quicker answers had you consulted this site’s FAQ entry for : How to install and run a script in PythonScript

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