shell script

A handy one-liner

April 24th, 2008  |  Tags: , ,  |  Leave a comment

I used a catch-all email address for quite a while on willbenton.com. This is great if you use a lot of throwaway addresses (i.e. for obnoxious compulsory web registrations), but the amount of spam is truly oppressive. I recently axed the catch-all address, and thus had to answer the question: “which willbenton.com email addresses have I received useful mail at?” Here’s a handy one-line script that will show you all the email addresses you’ve received mail at, assuming you use Apple’s Mail.app:

grep Envelope-to: `find $HOME/Library/Mail -name \*.emlx` | cut -f2 -d\ | cut -f1 -d, | tr A-Z a-z | sort | uniq

(This will work with minimal changes in other mailbox formats — you’ll probably only have to change the find part.)