• Login
Community
  • Login

Show only lines that contain a given search argument

Scheduled Pinned Locked Moved General Discussion
9 Posts 5 Posters 820 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.
  • N
    nightrider43
    last edited by May 14, 2024, 12:26 PM

    Hey guys!
    How could I make notepad++ show on the screen only lines that contain a certain search argument? For example, all lines of the text being edited that contain the expression “move zero” (without the quotation marks).
    There are editors that even allow the use of and/or.
    “move zero” or “move 9” for example or
    “move zero” and “move 9”.

    E A P 3 Replies Last reply May 14, 2024, 12:40 PM Reply Quote 0
    • E
      Ekopalypse @nightrider43
      last edited by May 14, 2024, 12:40 PM

      @nightrider43

      The answer depends on the specific use case, i.e. what you want to achieve.
      In general, there are ways to get rid of “unwanted lines”, but if you are looking for a built-in way to filter a view of a document and edit that document in that filtered view, then there is not.

      1 Reply Last reply Reply Quote 0
      • A
        Alan Kilborn @nightrider43
        last edited by May 14, 2024, 1:23 PM

        @nightrider43

        I don’t know that it is really needed.
        I’d use Find All in Current Document.
        Then you have a panel (Search results) that shows you what you are asking for, with an easy “jump to” the real lines that are shown in it.

        N 1 Reply Last reply May 14, 2024, 1:57 PM Reply Quote 3
        • N
          nightrider43 @Alan Kilborn
          last edited by May 14, 2024, 1:57 PM

          @Alan-Kilborn

          I had never realized. This suggestion of yours really meets what I needed. Better than that, only the search results appear directly on the main screen or in a tab instead of a panel with a few lines at the bottom of the screen.
          But that’s right, I recognize that your suggestion solved my problem.
          Thank you very much.

          P 1 Reply Last reply May 14, 2024, 2:17 PM Reply Quote 2
          • P
            PeterJones @nightrider43
            last edited by May 14, 2024, 2:17 PM

            @nightrider43 said in Show only lines that contain a given search argument:

            only the search results appear directly on the main screen or in a tab instead of a panel with a few lines at the bottom of the screen.

            You can resize the panel. Or even pop it out into its own window (see the Panel Mechanics description in the Online User Manual)

            1 Reply Last reply Reply Quote 2
            • P
              Petra Handwerg @nightrider43
              last edited by May 21, 2024, 6:59 AM

              @nightrider43 I use the “Mark” tab in the search dialogue:

              Find what: (whatever you search)

              Bookmark line

              Wrap around

              (if necessary further settings)
              Click on “Mark All”, then “Close”.

              Goto “Search” > “Bookmark” > “Cut (or Copy) Bookmarked Lines” and paste it whereever you want.

              That’s an alternative way to “Find All in Current Document” - and you don’t need to remove the prefix "Line nn: " in the result list.

              A 2 Replies Last reply May 21, 2024, 11:08 AM Reply Quote 1
              • A
                Alan Kilborn @Petra Handwerg
                last edited by Alan Kilborn May 21, 2024, 11:08 AM May 21, 2024, 11:08 AM

                @Petra-Handwerg

                Just noting that the OP didn’t express a desire for copying lines of interest to another place, but simply “showing lines” as per the title of the thread.

                But like my post earlier, maybe your post gives others ideas about what they didn’t know they could do.

                1 Reply Last reply Reply Quote 2
                • A
                  Alan Kilborn @Petra Handwerg
                  last edited by May 22, 2024, 10:59 AM

                  @Petra-Handwerg said in Show only lines that contain a given search argument:

                  …an alternative way to “Find All in Current Document” - and you don’t need to remove the prefix "Line nn: " in the result list.

                  And more of what you maybe didn’t know: If you right-click in the Search results window, the popup menu will have a Copy choice and a Copy Lines choice – Copy will get the “Line nn:” info with the line data, whereas Copy Lines will get ONLY the line data.

                  P 1 Reply Last reply May 27, 2024, 6:38 AM Reply Quote 4
                  • P
                    Petra Handwerg @Alan Kilborn
                    last edited by May 27, 2024, 6:38 AM

                    @Alan-Kilborn said in Show only lines that contain a given search argument:

                    And more of what you maybe didn’t know: If you right-click in the Search results window, the popup menu will have a Copy choice and a Copy Lines choice – Copy will get the “Line nn:” info with the line data, whereas Copy Lines will get ONLY the line data.

                    Oh, great tip, thank you! I wasn’t aware that the result section has its own context menu.

                    Good to know!

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