notepad4 icon indicating copy to clipboard operation
notepad4 copied to clipboard

Delete lines matching string

Open borkfomb opened this issue 1 year ago • 4 comments

Hi, what is the process for deleting all lines matching a string? Here's what I tried,

Find Text, [enter string], Select All [all matches are now highlighted] Edit > Lines > Delete Line

This deletes only the final line containing a match. Is there a Select All Lines/Select Highlighted Lines option? Thanks

borkfomb avatar Dec 13 '24 13:12 borkfomb

  1. On "Find Text", check "Bookmark matched line", then "Find All".
  2. Edit -> Bookmarks -> Select All, then press Delete key. image image

zufuliu avatar Dec 13 '24 13:12 zufuliu

Thank you for the quick reply, I would never have discovered that. I was expecting a Select Highlighted Lines option somewhere then to simply hit Delete.

For reference, here's the process in Sublime Text.

  • Find Text, [enter string], Select All
  • Expand Selection to Line (Ctrl+L)
  • Delete

borkfomb avatar Dec 13 '24 13:12 borkfomb

Expand Selection to Line (Ctrl+L)

Here is "Select Lines (Expand Selection)", but it currently only handles main selection. image

zufuliu avatar Dec 14 '24 01:12 zufuliu

I think on the Find/Replace dialog box you could have a small droplist button of less-used actions, which could include this as well as its converse, Delete lines not containing, and maybe Select All might also go on it. When choosing the action from the droplist it executes it much as clicking a button would.

meteorquake avatar Mar 07 '25 18:03 meteorquake