Want to scan pine mail folders for e-mail addresses ... Tips?

This is a discussion on Want to scan pine mail folders for e-mail addresses ... Tips? within the Pine forums in Other Technologies category; A friend's friend suggested this: << this is how i'd do it. output is a sorted, unique list of email addresses in all files in that folder. grep -ho -E "\b[A-Za-z.%+-]+@[A-Za-z.-]+\.[A-Za-z]{2,4}\b" * | sort | uniq >> Tried that and got grep: invalid option -- o Took out the 'o' and got this, which is a start, but not perfect. | sort | uniq for <name @ www.alvord.com>; Fri, 21 Mar 2008 14:09:26 -0800 for <name @ www.alvord.com>; Fri, 21 Mar 2008 15:17:41 -0800 for name@alvord.com ; for <name @ alvord.com>; Fri, 21 Mar 2008 15:09:07 -0700 (PDT) for <name ...

Go Back   Application Development Forum > Other Technologies > Pine

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-14-2008, 02:30 AM
Benjamin Lukoff
Guest
 
Default Want to scan pine mail folders for e-mail addresses ... Tips?

A friend's friend suggested this:

<< this is how i'd do it. output is a sorted, unique list of email
addresses in all files in that folder.

grep -ho -E "\b[A-Za-z.%+-]+@[A-Za-z.-]+\.[A-Za-z]{2,4}\b" * | sort | uniq
>>


Tried that and got
grep: invalid option -- o

Took out the 'o' and got this, which is a start, but not perfect.

| sort | uniq
for <name@www.alvord.com>; Fri, 21 Mar 2008 14:09:26 -0800
for <name@www.alvord.com>; Fri, 21 Mar 2008 15:17:41 -0800
for name@alvord.com;
for <name@alvord.com>; Fri, 21 Mar 2008 15:09:07 -0700 (PDT)
for <name@alvord.com>; Fri, 21 Mar 2008 16:17:27 -0700 (PDT)
> On Wed, Mar 19, 2008 at 11:31 PM, Benjamin Lukoff <name@alvord.com> wrote:
> name@crosscut.com

From name@crosscut.com Fri Mar 21 14:09:27 2008
From name@crosscut.com Fri Mar 21 15:17:43 2008
From: "Lisa" <name@crosscut.com>
On Fri, Mar 21, 2008 at 3:09 PM, Lisa <name@crosscut.com> wrote:
On Wed, Mar 19, 2008 at 11:31 PM, Benjamin Lukoff <name@alvord.com> wrote:
Return-Path: <name@crosscut.com>
To: "Benjamin Lukoff" <name@alvord.com>
name@crosscut.com


What I'm really looking for is an output like this:

name@alvord.com
name@crosscut.com
name@gmail.com
Etc.

Any ideas?
Thanks!
Ben Lukoff, Seattle.
<[mylastname] @ gmail.com>

Reply With Quote
  #2  
Old 08-14-2008, 09:09 AM
Allodoxaphobia
Guest
 
Default Re: Want to scan pine mail folders for e-mail addresses ... Tips?

On Wed, 13 Aug 2008 23:30:34 -0700, Benjamin Lukoff wrote:
>
> What I'm really looking for is an output like this:
>
> name@alvord.com
> name@crosscut.com
> name@gmail.com
> Etc.
>
> Any ideas?


Here is what I use (on FreeBSD) to generate a whitelist from inside my
..profile each time I login. The section that process my sent-mail.XXXXX
folders might interest you. As with most things out here on the net:
it's not original by me and YMMV.
__________________________________________________ _______________________

[jonesy~]cat bin/whitelist
#!/bin/sh
# Generate a whitelist of email addys from .addressbook and sent-mail.
# Used in procmail recipe(s) to determine "goodness" of From:'s in emails.
# ref: http://www.xray.mpe.mpg.de/mailing-l.../msg00315.html

LOCK_FILE=$HOME/tmp/.whitelist.lock

(set -C; : > $LOCK_FILE) 2> /dev/null
if [ $? != "0" ]; then
echo "Whitelist being updated by another process - skipping"
exit 1
fi

# Release the lock on `exit`.
trap 'rm $LOCK_FILE' EXIT

#### Do whitelisting
###
##
#

tr -s '[:blank:],' '\n\n' < $HOME/.addressbook > $HOME/tmp/addressbook.tmp

cat $HOME/tmp/addressbook.tmp \
|fgrep "@" \
|sed -e "s/^.*[^A-Za-z0-9_.+-]\([A-Za-z0-9_.+-]*@\)/\1/" \
-e "s/\(@[A-Za-z0-9_.+-]*\)[^A-Za-z0-9_.+-].*$/\1/" \
|sort -fu \
> $HOME/tmp/whitelist.tmp


cat $HOME/mail/sent-* \
|egrep -i "^To: .*@|^Cc: .*@" \
|sed -e "s/^.*[^A-Za-z0-9_.+-]\([A-Za-z0-9_.+-]*@\)/\1/" \
-e "s/\(@[A-Za-z0-9_.+-]*\)[^A-Za-z0-9_.+-].*$/\1/" \
|sort -fu \
>> $HOME/tmp/whitelist.tmp


sort -fu $HOME/tmp/whitelist.tmp > $HOME/Procmail/whitelist

rm $HOME/tmp/addressbook.tmp $HOME/tmp/whitelist.tmp

#
##
###
#### Done whitelisting

__________________________________________________ _________


I know, at least 2 UUOC nominations........

HTH,
Jonesy
--
Marvin L Jones | jonz | W3DHJ | linux
38.24N 104.55W | @ config.com | Jonesy | OS/2
*** Killfiling google posts: <http://jonz.net/ng.htm>
Reply With Quote
  #3  
Old 08-15-2008, 01:30 AM
Benjamin Lukoff
Guest
 
Default Re: Want to scan pine mail folders for e-mail addresses ... Tips?

On 8/14/08 6:09 AM, in article slrnga8bl3.2pub.bit-bucket@shell.config.com,
"Allodoxaphobia" <bit-bucket@config.com> wrote:

> On Wed, 13 Aug 2008 23:30:34 -0700, Benjamin Lukoff wrote:
>>
>> What I'm really looking for is an output like this:
>>
>> name@alvord.com
>> name@crosscut.com
>> name@gmail.com
>> Etc.
>>
>> Any ideas?

>
> Here is what I use (on FreeBSD) to generate a whitelist from inside my
> .profile each time I login. The section that process my sent-mail.XXXXX
> folders might interest you. As with most things out here on the net:
> it's not original by me and YMMV.
> __________________________________________________ _______________________
>
> [jonesy~]cat bin/whitelist
> #!/bin/sh
> # Generate a whitelist of email addys from .addressbook and sent-mail.
> # Used in procmail recipe(s) to determine "goodness" of From:'s in emails.
> # ref:
> http://www.xray.mpe.mpg.de/mailing-l.../msg00315.html
>
> LOCK_FILE=$HOME/tmp/.whitelist.lock
>
> (set -C; : > $LOCK_FILE) 2> /dev/null
> if [ $? != "0" ]; then
> echo "Whitelist being updated by another process - skipping"
> exit 1
> fi
>
> # Release the lock on `exit`.
> trap 'rm $LOCK_FILE' EXIT
>
> #### Do whitelisting
> ###
> ##
> #
>
> tr -s '[:blank:],' '\n\n' < $HOME/.addressbook > $HOME/tmp/addressbook.tmp
>
> cat $HOME/tmp/addressbook.tmp \
> |fgrep "@" \
> |sed -e "s/^.*[^A-Za-z0-9_.+-]\([A-Za-z0-9_.+-]*@\)/\1/" \
> -e "s/\(@[A-Za-z0-9_.+-]*\)[^A-Za-z0-9_.+-].*$/\1/" \
> |sort -fu \
>> $HOME/tmp/whitelist.tmp

>
> cat $HOME/mail/sent-* \
> |egrep -i "^To: .*@|^Cc: .*@" \
> |sed -e "s/^.*[^A-Za-z0-9_.+-]\([A-Za-z0-9_.+-]*@\)/\1/" \
> -e "s/\(@[A-Za-z0-9_.+-]*\)[^A-Za-z0-9_.+-].*$/\1/" \
> |sort -fu \
>>> $HOME/tmp/whitelist.tmp

>
> sort -fu $HOME/tmp/whitelist.tmp > $HOME/Procmail/whitelist
>
> rm $HOME/tmp/addressbook.tmp $HOME/tmp/whitelist.tmp
>
> #
> ##
> ###
> #### Done whitelisting
>
> __________________________________________________ _________
>
>
> I know, at least 2 UUOC nominations........
>
> HTH,
> Jonesy


Thanks, I'll give it a shot!
Ben

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:57 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.