[wellylug] Awk / mail processing

Volker Kuhlmann list0570 at paradise.net.nz
Tue Feb 25 22:51:39 NZDT 2003


> I was wondering if someone here could indicate me how I could process a bunch 
> of mail (got by fetchmail) to remove headers and attachements, keeping just 
> the "from", "subject" "date" and text and save it into one txt file / mail
> 
> I thought that (g)awk could be the solution, but any advice on this matter 
> would be nice, since I know very little about (g)awk.  

gawk would be able to do the job. You need to restrict your filtering
to the email headers really. procmail is always a very good choice.
formail can remove any header(s) you specify, and you can run it as a
filter without procmail, but I don't think it has an option of "keep
these headers and throw the rest".

In procmail, you could simply do this:

:0 fhw
| egrep -vi '^(from |from:|subject:|date:)'

This filters, afterwards you do something with the mail (e.g. save).
You could put this into a separate file and call procmail with it, to
keep it separate from the rest of your procmail filtering.

Volker

-- 
Volker Kuhlmann			is possibly list0570 with the domain in header
http://volker.dnsalias.net/		Please do not CC list postings to me.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/FpY02D/vN2EAA/xGHJAA/0XFolB/TM
---------------------------------------------------------------------~->

  .-.   Wellington
  /V\   Linux
 // \\  Users       
/(   )\ Group
 ^^-^^
        http://wlug.paradise.net.nz/

To unsubscribe from this group, send an email to:
wellylug-unsubscribe at egroups.com
  

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the wellylug mailing list