is there away to get only the lines containing a particular string to be displayed to allow easier editing

  • Say you have a file that is 2 or 3 thousand lines long and you need to make changes to just the lines that have a particular string in them but the change depends on the line found.
    No way to predict.
    So after the search is carried out you want to be able to carry on editing but just have those lines displayed.
    When finished you go back to displaying the complete file.

  • @David-Findlay

    Well, there is a “hide lines” feature, but it can’t easily be tied into a search.
    Really, though, I just do a normal “Find All” and then, the lines with the hits are in the Search results panel, and I just double-click on a line there to edit that line, double-click another to edit a different line, etc.
    Note that although it jumps you to the match point in the line, you can certainly move from there to another point in the line to edit, if that’s what you need.
    I understand what you’re asking, I just don’t find it all that necessary, myself.

  • @David-Findlay ,

    Not exactly. But I think I will get something that will work for you.

    1. Use the Search > Mark… dialog to bookmark the matching lines
      • set FIND WHAT to look for the “particular string”
      • checkmark ☑ the box for ☑ Bookmark Line
      • click Clear all marks to make sure that nothing else is marked or bookmarked right now
      • click Mark All – it will mark (color) the matching text and bookmark (● in the left column) the individual lines that have a match
      • close the Mark dialog
    2. Use the Search > Bookmark > Next/Previous Bookmark (or the F2/Shift+F2 keystroke equivalents) to navigate between the various matches
      • in my screenshot, F2 will move you between line 1, line 3, and line 4

    So it doesn’t hide the other lines, but it makes it easy to navigate to just the matching lines.

  • @Alan-Kilborn Thank you. I did not know about being able to double click the line in Search results to jump to that location. Very Helpfull.

  • @PeterJones Thank you very much. Works well. Wow there is a lot to learn about what notepad++ can do.

Log in to reply