[ale] Need some scripting assistance

Byron A Jeff byron at cc.gatech.edu
Wed Jun 28 12:36:25 EDT 2006


On Wed, Jun 28, 2006 at 10:51:33AM -0400, Ryan Fish wrote:
> I am in need of help with figuring out how to grep for "mail.panteq.com"
> within /var/spool/mqueue/* and deleting every message that contains this
> string.

Try this on for size (note it is only minimally tested):

################# cut here #######################
#!/bin/bash
for mail in /var/spool/mqueue/* ; do
  grep -q "mail\.panteq\.com" "$mail" && rm -i $mail
done
################# cut here #######################

If you feel real sure about it you can remove the -i from the rm command.

Hope this helps,

BAJ



More information about the Ale mailing list