SPUG: Inspired, broken.

Atom Powers atomic at wyrdtech.com
Wed Feb 9 14:14:16 PST 2005


> 
> Although from the looks of your code, I think may be expecting that to 
> potentially match more than one address per line, which it actually 
> doesn't.  If there is the possibility of two addresses being on one 
> line, you'd want something like this.
> 
> sudo /bin/bash -c 'perl -wnl -e "print lc($&).q{ OK}
>   while m/\w+\@\w+\.\w{3}/g" addresses.txt > outfile.txt'

Nope, only one address per line. If there is more than one (or any country code 
domains either) then I don't want them.

> I looked, but I didn't see a command line parameter to instruct perl to 
> redirect stdout by default, to avoid all the /bin/bash nonsense.  Anyone 
> know of anything like that appropriate for one liners?
> 
> The only thing close was -i, which isn't really waht you want.
> 

I toyed with the idea of something like this:
/usr/bin/perl5 -wnl -e 'm/\w+\@\w+\.\w{3}/ and open(DATA,">","recipients.txt") 
and print DATA "\L$&\E OK";' /usr/home/mailman/address_list.txt

But I didn't know if reopening the file with every match would cause a problem.


More information about the spug-list mailing list