Community
    • Login

    New displaying of the "Search Results" panel

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 1 Posters 149 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.
    • guy038G Offline
      guy038
      last edited by guy038

      Hello, All,

      One minor drawback, when you display the Search results panel, is that the name of each file does not appear before the line number and the line itself !

      See, for example, this post : https://community.notepad-plus-plus.org/topic/21722/format-of-search-results

      Here is the way to realize this goal !


      Once any Search Results panel is displayed :

      • Hit the Ctrl + A shortcut

      • Hit the Ctrl + C shortcut

      • Open a new tab ( Ctrl + N )

      • Paste the Search Results contents in this new tab ( Ctrl + V )

      • Run the option Edit > Line operations > Reverse line order ( IMPORTANT )

      • Now, open the Replace dialog ( Ctrl + H )

      • Uncheck all box options

      • FIND (?-si)^\tLine\x20+(\d+)(?=(?s:.+?)^\x20\x20\u:.*\\(.+)(?= \())|^\x20\x20\u.+\R

      • REPLACE ?2\2\t\1\t

      • Check the ‘Wrap around’ option

      • Select the Regular expression search mode

      • Click on the Replace All button

      • Now, re-run the Edit > Line operations > Reverse line order option ( IMPORTANT )

      • Finally, save this new tab for future study within N++ or Excel !


      For a more appealing presentation within N++, if you have the Columns++ plugin, do the following actions :

      • Check the Elastic tabstops option

      • Run the Convert tabs to spaces option


      For example, I did a search of the word the, whatever its case, in Normal mode, on any .txt file of an USB key

      Search "the" (76665 hits in 498 files of 578 searched) [Normal]
      

      I got an INPUT file of 51,224 lines for about 10,2 Mb

      And, after the above process :

      • Reverse line order

      • Regex Replacement

      • Reverse line order

      Which took 66s, I got an OUTPUT file of 50,713 lines, for about 12 Mb, with filename, number and text aligned

      And in order to right-aligned the line numbers, do the following regex replacement :

      FIND (\d+)(\x20*)(?=\x20:\x20)

      REPLACE \2\1

      206d94c6-772e-4ae9-807d-ddf792ec10e6-image.jpeg

      Voila !

      Best Regards,

      guy038

      1 Reply Last reply Reply Quote 0
      • guy038G guy038 referenced this topic
      • guy038G Offline
        guy038
        last edited by guy038

        Hi, All,

        From the @pellelin’s post, here is an improvement of my previous post : I now added the complete path of each file , followed with a \ character and the file name !


        Once any Search Results panel is displayed :

        • Hit the Ctrl + A shortcut

        • Hit the Ctrl + C shortcut

        • Open a new tab ( Ctrl + N )

        • Paste the Search Results contents in this new tab ( Ctrl + V )

        • Run the option Edit > Line operations > Reverse line order ( IMPORTANT )

        • Now, open the Replace dialog ( Ctrl + H )

        • Uncheck all box options

          • FIND (?-si)^\tLine\x20+(\d+)(?=(?s:.+?)^\x20\x20(\u:.*\\.+)(?=\x20\())|^\x20\x20\u.+\R

          • REPLACE ?2\2\t\1\t

        • Check the Wrap around option

        • Select the Regular expression search mode

        • Click on the Replace All button

        • Now, re-run the Edit > Line operations > Reverse line order option ( IMPORTANT )

        • Finally, save this new tab for future study within N++ or Excel !


        Now, @pellelin, if you don’t have already the Columns++ plugin installed in your configuration, I kindly advice you to install it !

        • After installation of this plugin, close and re-open Notepad++

        • First, run the Plugins > Columns++ > Elastic tabstops option

        • Then run the Plugins > Columns++ > Convert tabs to spaces option

        • Now, in order to right-aligned the line numbers, do the following regex replacement :

          • FIND (\d+)(\x20*)(?=\x20:\x20)

          • REPLACE \2\1

        With the same parameters, in the Replace dialog, than above !


        For example, I did a search of the word the, whatever its case, in Normal mode, on any .txt file of an USB key

        Search "the" (77312 hits in 507 files of 590 searched) [Normal]
        

        I got an INPUT file of 51,5544 lines for about 10,2 Mb

        And, after the above process :

        • Reverse line order

        • Regex Replacement

        • Reverse line order

        Which took 82s, I got an OUTPUT file of 51,047 lines, for about 12,2 Mb, with Complete file path, Line number and Text, all aligned

        b25954ec-283c-4b15-9603-bf0d370d3c2d-image.jpeg

        Best Regards,

        guy038

        P.S. :

        In this version, I didn’t report the number of hits. If this information matters too, just ask me about it !

        1 Reply Last reply Reply Quote 0

        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