Spamassassin one-liner to tag & move mail with an X-Spam-Flag: YES to a new directory?
- by ane
Say you have a directory with tens of thousands of messages in it. And you want to separate the spam from the non-spam.
Specifically, you would like to:
Run spamassassin against the directory, tagging each message with an X-Spam-Flag: YES if it thinks it's spam
Have a tcsh shell or perl one-liner grep all mail with the flag and move those mails to /tmp/spam
What command can you run to accomplish this? For example, some pseudocode:
/usr/local/bin/spamassassin -eL ./Maildir/cur/* | grep "X-Spam-Flag: YES" | mv %1 /tmp/spam