Trying to Make an Alias Execute a Perl Script

peter at vfemail.net peter at vfemail.net
Wed Feb 9 19:55:37 UTC 2011


At 02:42 PM 2/5/2011, peter at vfemail.net wrote:

>     *   *   *        
>I've tried this entry in my /etc/mail/aliases file, but it returns an empty e-mail messages:
>
>     extract: "| perl -wne 'while(/[\S\.]+@[\S\.]+\w+/g){print "$&\n"}' | mail user"
>     
>[and this one]:
>
>     extract: "| cat > datafile | perl -wne 'while(/[\S\.]+@[\S\.]+\w+/g){print "$&\n"}' < datafile | mail user"
>
>but [they] return an empty e-mail message rather than a list of e-mail addresses.  
>
>What am I overlooking?  


A kind soul helped me figure out how to make this work.  This e-mail alias:

    extract:      "| cat > /home/peter/datafile | /home/peter/extract.pl < /home/peter/datafile | mail -s \"Results\" user 

combined with this Perl script:

     #!/usr/bin/perl
     while (<STDIN>)
        { while(/[\S\.]+@[\S\.]+\w+/g){print "$&\n"};
        };

delivers the desired list of e-mail addresses.

   


-------------------------------------------------
This message sent via VFEmail.net
http://www.vfemail.net
$14.95 Lifetime accounts!  15GB disk!  No bandwidth quotas!
 


More information about the freebsd-questions mailing list