Searching mail archives

Julian Field MailScanner at ecs.soton.ac.uk
Thu Jan 17 16:27:55 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Graham S. Jarvis wrote:
> Hello,
>
> 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).
But how are you creating the archive? If it's MailScanner doing it, then 
normally the archive will be the original messages, without any 
MailScanner additions to them at all. So you won't be able to tell if 
they were spam or not, unless you grep the maillog to pull out the 
message queue ids of all the spam found.

>
> Anyone prepared to code this for us non-programmer types ;-)
>
> Again, thanks for the idea!
>
> -Graham-
>
>
>
> Denis Beauchemin wrote on 17/01/2008 16:40:
>> Julian Field a écrit :
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> 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
>>
>

Jules

- -- 
Julian Field MEng CITP CEng
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store

Need help customising MailScanner?
Contact me!
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654


-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.7.0 (Build 1012)
Comment: (pgp-secured)
Charset: ISO-8859-1

wj8DBQFHj4ILEfZZRxQVtlQRArzcAJ99K2DazoGlEY/OO/FNRmWKWGhXBwCfYR6G
6qWOV1t1dWjdqdQunkXwg2I=
=LWcq
-----END PGP SIGNATURE-----

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MailScanner mailing list