Community
    • Login

    How to search many conditions automatically?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 1.1k 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.
    • Григорий НовожиловГ Offline
      Григорий Новожилов
      last edited by

      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
      • Neil SchipperN Offline
        Neil Schipper
        last edited by

        @Григорий-Новожилов 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

        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