The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 Grabbing the To: field from a mailbox
Author: Dan 
Date:   05-12-03 13:38

When I get bounces for FreshPorts, I throw them all into a single mailbox (remove.txt) and this this command to extract the email addresses which bounced:

sed -n 's/^To: *\(.*\)$/\1/p' remove.txt | sed '/</s/^.*<\([^>]*\)>.*$/\1/'

The first expression grabs the To: field. The second removes replaces "Foo <foo@>" with "foo@".

Included in the above output will be the addresses to which the bounce messages have been sent. This removes those and puts the results into remove-these.txt

sed -n 's/^To: *\(.*\)$/\1/p' remove.txt | sed '/</s/^.*<\([^>]*\)>.*$/\1/' | egrep -v "FreshPorts-Announce@example.org|FreshPorts-Watch@example.org" > remove-these.txt

My thanks to tjr for providing this script.

--
Webmaster

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org