4

Due to some bad cron jobs I now have ~1600 mail messages, most of them containing the same error log. I would like to quickly group them by subject and delete them, while limiting the chances of missing some important message.

I couldn't figure out a way to do anything using the mail command other than deleting each message individually. I tried installing pine, but it seems that even there I have to go over each message individually and hit the D key.

Surely there's a way to script this. Right?

I'm using ubuntu server 10.04.

2 Answers 2

4

Mutt is really good at this. You could tag-pattern (shift-T) on the common subject string, then tag-prefix (;) delete (d) the matching messages.

"Mutt Manual, Using Tags"

3

If your mails are in a Maildir (like e.g. ~/Maildir/cur) you can just use grep and rm:

grep -l "Subject: My error log message" ~/Maildir/cur/* | xargs rm

if instead they are in a mbox this of course doesn't work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .