Howdy,
Easy enough:
Code:
cd /home(x)/user/mail/; ls -a|grep @|awk '{print $2}' FS="."
should do most of it. The only thing that might be off is the tld that you're using so in my case I added it to this:
Code:
cd /home2/fishmail/mail/; ls -a|grep @|awk '{print $2}' FS="."|replace _net .net
you'll likely need to do the same for your .tld.