[lug] Virtual Mail User - Large Mailbox Scrubbing

Jeff Schroeder jeff at zingstudios.net
Thu Jun 29 15:39:44 MDT 2006

Ryan asked:

>  I would like to start by removing all messages that have
>  "Undeliverable" in the subject heading.

The quick-and-dirty grep command would be something like this:

for file in `grep -li "^Subject:.*undeliverable"`; do rm $file; done

I believe that will work even for long lists of files; if you attempted 
to just remove them at once using

rm `grep -li "^Subject:.*undeliverable"`

you may run into problems because the argument list to 'rm' will be too 
long.  (Using xargs would solve that, but I actually don't know how to 
use xargs, heh.)

Also note that using the -i argument to grep will do case-insensitive 
matching so you can find "undeliverable", "Undeliverable", and 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20060629/1cdcff95/attachment.pgp>

More information about the LUG mailing list