1. Get a list of all the delete comment URLs from the admin interface. You have to go into the admin interface, click Manage/await-moderation. This will give you the potentially very large page of links to delete those comments. Save this in a file.
2. Grep the deletecomment URLs from that file. They will look something like this:
I use a simple python script to grep these.
3. Use CURL to login to your blog's admin interface, and save the resulting cookies into a file. This is called a cookie jar in CURL:
curl -d "log=YOUR_USER_NAME&pwd=YOUR_PASSWORD" -c cookie_file www.yourblog.com/wp-login.php
4. Now you can use CURL to call those delete URLs, using the cookie jar. But first you have to specify the referrer to get pass wordpress' security:
curl -e "http://www.ourblog.com/wp-admin/moderation.php" -b cookie_file "http://www.yourblog.com/wp-admin.php?action=deletecomment&p=540&comment=43565"
Got ? It's that easy.