[ILUG] Searching for attachments in email
Pádraig Brady
P at draigBrady.com
Tue Feb 6 17:18:01 GMT 2007
Thomas Rooney wrote:
> I posted this earlier from an other account might it have
> gone for moderation?
>
> HI All
>
> I need to search an excel document for the word " brno"
> the problem and the point where this relates to Linux is the
> excel docs that need to be searched are in attachments
> in users email accounts. The server is running courier-imap
> on SUSE 9.3.
>
> What I think I need to do is find some way to find all files
> created between two dates (I have a date range) and
> have an attached excel file with the at lest one of the words
> "over" or "held" in the file name then extract the attached
> excel files and copy them to some place on my local PC
> its running Ubunut 6.10.Then run an open office macro over
> them to find the phrase I require
>
> How would one extract the excel files without going in via
> the imap server as this would be tedious because of the amount
> of email accounts on the box and the number of folders in each
> account.
>
> I have root on this box and can ssh to it. Any Ideas.
Untested...
find ~/Maildir/ -type f -print0 | #man find to specify dates
LANG=C xargs -r0 grep -Fl 'Content-Type: application/vnd.ms-excel' |
while read file; do
recode /b64.. < $file | grep -qF " brno" &&
echo $file
done
More information about the ILUG
mailing list