• Login
Community
  • Login

How to search many conditions automatically?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
2 Posts 2 Posters 727 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.
  • Г
    Григорий Новожилов
    last edited by Oct 6, 2021, 7:02 PM

    Hi, I have two files (.txt):
    1.The condition file
    2.The results file
    The condition contains many lines of data which I need to compare in the results and find out count of each line. I did it with ctr+f, but it`s too long and takes so many time.

    How can I find out, what I should do to find how many lines of the conditions have in the results and create report file (“condition” “how many matches have in numbers”) automatically?

    Thx for answers0efe1cd5-88df-4057-9c43-d5b4859ce952-image.png a191ee41-cb6e-4e23-b772-25ddd3d727d5-image.png d8a2e70c-8b4e-4880-bec3-f411667d8016-image.png

    1 Reply Last reply Reply Quote 0
    • N
      Neil Schipper
      last edited by Oct 6, 2021, 10:05 PM

      @Григорий-Новожилов My interpretation of your need as pseudocode:

      For each string in Condition between first occurrence on a line of // and the next occurrence of /

      For each occurrence of that same string in result, also between a leading double slash and single slash on a line

      advance count

      What I’d probably do is:

      Prepare:

      • Make safe copies of both files.
      • Obtain a modern Windows “diff” (file & directory compare) tool. You can install the Compare plugin (Plugins, Admin…), but standalone ones are friendlier and more sophisticated and there are good free options.

      Then:

      • Clean both files so they contain only the strings of interest, one per line. This can be done with a macro (incorporating a {non-regex} find), or, a regex S&R. (Try learning and fooling around with these on your own. https://npp-user-manual.org/docs/searching/ If you need help, ask.)
      • Sort first cleaned file (menu: Edit, Line operations).
      • Sort second cleaned file.
      • Use diff tool on the cleaned sorted files.

      Now the mismatches in counts will jump out at you, and it will be much easier to count them.

      Note that (a copy of) the cleaned (and maybe sorted, your preference) Condition file can be the start point for your report file.

      If this is still too hard (because very big files, or, many entries, or done frequently) there will be a need for more sophistication.

      Some fancy diff tools might have options to automate the counting.

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