I got thousends of spam comments on my drupal 7 site. The mysql database file is grown to 1.9GB and the site is broken. How can i delete all comments (or even better: all unapproved comments) from the database dump file?
From your dump file, I would cut the part that insert the data to the comment table. Note: Leave the part that create the table.
In another file paste the part that you cut from the original dump file, using a text editor that can handle to search using regular expressions (as Sublime Text 2). Create the regular expression that would give you as a result the complete row insert if that row has the status column value set to one. Once that the regular expression is working, now use the search an replace. Search all the matches and replace them with ''
When the search and replace is done, you can copy and paste to the sql tab if you are using phpMyAdmin, or even save the resulting file as .sql and import it.
Pretty much the laborious part would be to find the regular expression to use.
Hope this help!