Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Feb 2011 14:54:17 -0500
From:      peter@vfemail.net
To:        freebsd-questions@freebsd.org
Subject:   Re: Trying to Make an Alias Execute a Perl Script
Message-ID:  <20110209195537.8AD6A106564A@hub.freebsd.org>
In-Reply-To: <20110205194334.33D6D106566C@hub.freebsd.org>
References:  <20110205194334.33D6D106566C@hub.freebsd.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

At 02:42 PM 2/5/2011, peter@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!
 



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20110209195537.8AD6A106564A>