Because I am too stupid to pull this out of my shell history or make an alias for it, I post the one-liner I use to extract From addresses from email that my spam blocker incorrectly flags as spam. Those addresses end up in my white list.
grep ^From: fix | perl -pe 's/From:\s+//; s/.*<(.*@.*)>.*/$1/' | sort | uniq >> ~/.procmail/goodfile
I suppose that is rather unixy, those other programs have Perl implementations somewhere.
Now I'll probably forget how to find this post, too.
That can be trimmed down (Score:1)
Re:That can be trimmed down (Score:2)
Re:That can be trimmed down (Score:2)
Re:That can be trimmed down (Score:1)
Re:That can be trimmed down (Score:1)
!$seen{$key}++trick.Re:That can be trimmed down (Score:2)
The address lines look like:
I may not need the grep, but it sure makes things easier to figure out when there is a problem. When I try to do such things in one big step, I usually find that I miss something special about the input then have to waste a lot of time figuring o
Re:That can be trimmed down (Score:1)
Re:That can be trimmed down (Score:2)
Not to be mean, but there really are good reasons for not trying to be too clever. My kludgey looking one liner works, it is easy to understand, and is even faster. Remember, test any code that you post because once it gets online, it lives on forever.
Just for giggles, I timed these against a file of over 1,000 email. I added the filename as a command line argument after your perl invocation, and on average, it took about 0.25
Re:That can be trimmed down (Score:1)
Re:That can be trimmed down (Score:2)
Re:That can be trimmed down (Score:1)