Searching mail archives

Graham S. Jarvis gsjarvis at
Thu Jan 17 16:06:47 GMT 2008


MANY thanks !!!!

This is what I've been looking for for a while now -
So, how does "one" I expand this to remove all the spam from my archives?

i.e. Each day have cron run a job to remove the df (and qf) files where 
the df file contains "Spam?".
(Or be more clever and use the spam score header).

Anyone prepared to code this for us non-programmer types ;-)

Again, thanks for the idea!


Denis Beauchemin wrote on 17/01/2008 16:40:
> Julian Field a écrit :
>> Hash: SHA1
>> Dave C wrote:
>>> Nigel Kendrick wrote:
>>>> Hi,
>>>> I need to search a months-worth of mail archives
>>>> (/var/spool/MailScanner/archive/200611**) for a specific sender, 
>>>> subject and
>>>> attachment. I have had a play with grep and awk but I am not doing 
>>>> very
>>>> well!!
>>>> Are there any utilities to help or can anyone suggest a sensible 
>>>> command
>>>> line that will do the job?
>>>> Thanks
>>>> Nigel Kendrick
>>> This works pretty good for me.. (watch the word wrap and the 
>>> searchterm needs to be in single quotes)
>>> find /var/spool/MailScanner/archive/200611?? -type f -name df\* 
>>> -exec grep -il 'searchterm' {} \;     
>> What is enormously faster is
>> find /var/spool/MailScanner/archive/200611?? -type f -name df\* 
>> -print | xargs grep -il 'searchterm'
>> Jules
> If you are using Linux, grep can do recursive searches by itself:
>   -R, -r, --recursive
>    Read all files under each directory, recursively; this is  equiva-
>    lent to the -d recurse option.
> And, "grep -ril 'searchterm' /var/spool/MailScanner/archive/200611??" 
> would be shorter.
> Denis

More information about the MailScanner mailing list