Sublime - delete all lines containing a specific value

I have a 900mb log file that I can open in SublimeText 3. This file is bloated with lines similar to the following.

10/08/2014 23:45:31:828,Information,,,,ExportManager: ,No records to send and/or not connected

How can I filter out all rows containing No records to send and/or not connected

+61
sublimetext sublimetext3
Aug 11 '14 at 22:35
source share
6 answers

You can search and replace the regular expression:

Click Find> Replace.

Make sure the Regular Expression button is pressed.

In the "Find" field, put:

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

Leave the Replace box blank.

Click Replace All

+117
Aug 11 '14 at 10:45
source share

For people who do not want to write a regular expression, you can simply select the search line, press ctrl+cmd+g or select "Quick Search All" in the menu, in which you will get a choice for each corresponding line; from there Home move each selection pointer to the beginning of the line, shift+End will select each corresponding line, and del, del will delete all of them.

Editing multiple cursors is fun!

+36
Feb 17 '15 at 20:44
source share

I couldn't get the regex to work, so I used the 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

  • Select the line of interest
  • Press Alt + F3 to switch to multi-cursor mode in all occurrences ( Ctrl + CMD + G on Mac OS X)
  • Hit Ctrl + L [see comments] ( CMD + L on Mac)
  • Select a copy to another buffer
  • Del
+29
Feb 17 '15 at 19:46
source share

None of the regex code suggested above worked, but it worked:

 .*(text in question).* 
+11
Apr 22 '16 at 20:44
source share

This is what I found for Windows users:

  • Select a row (each row containing this row must be deleted).
  • Press ALT + F3.
  • Press Ctrl + L.
  • Click "Uninstall."
+7
Jan 28 '17 at 14:21
source share

I had a similar problem editing my sitemap

This worked for me:

  • Copy the last word in the lines you want to delete.
  • Find all
  • Press delete to delete the entire line.
0
Mar 17 '17 at 21:06
source share



All Articles