Sublime - delete all lines containing specific value

You can do a regular expression search-and-replace:

Click Find > Replace.

Ensure that the Regular Expression button is pressed.

For the Find What field, put:

^.*No records to send and/or not connected.*\n

Leave the Replace With field empty.

Click Replace All


For people that don't want to write a regex - you can just select the search string, hit ctrl+cmd+g or pick "Quick Find All" from the menu, which will get you selections for each matching string; from there Home will move every selection cursor to the start of the line, shift+End will select every matching line, and del, del will delete all of them.

Multiple cursor editing is fun!


i could not get the regex to work so I used Alt-F3 approach from this answer:

https://superuser.com/questions/452189/how-can-i-filter-a-file-for-lines-containing-a-string-in-sublime-text-2/598999#598999

  1. Select string of interest
  2. Hit Alt+F3 to go into multi-cursor mode on all occurrences (Ctrl+CMD+G on Mac OS X)
  3. Hit Ctrl+L [see comments] (Cmd+L on Mac)
  4. Copy-paste selection to another buffer
  5. Del

This is what i found for the windows users:

  1. Select the string (every line containing this string is to be removed).
  2. Press ALT+F3 .
  3. Press Ctrl+L .
  4. Press Delete .

Neither of the regex code suggested above worked in my case, but this did work:

.*(text in question).*