SPUG: Inspired, broken.

Atom Powers atomic at wyrdtech.com
Wed Feb 9 12:52:47 PST 2005


Inspired by last night's presentation at the Seattle Unix Group I put 
together this perl one-liner to grab email addresses out of a file.
It works, but I need to save the output to a file, "recipients.txt", and 
I'm having trouble.
What is the best way to save the output to a file?

#perl5 -wnl -e 'm/\w+@\w+\.\w{3}/ and print lc($&)." OK";' address_list.txt

I've tried this:
 >perl5 -wnl -e 'm/\w+@\w+\.\w{3}/ and print lc($&)." OK";' 
address_list.txt > recipients.txt
recipients.txt: Permission denied.

And this:
 >perl5 -wnl -e 'm/\w+@\w+\.\w{3}/ and print { ">recipients" } lc($&)." 
OK";' address_list.txt
print() on unopened filehandle >recipients at -e line 1, <> line 1225.
print() on unopened filehandle >recipients at -e line 1, <> line 1227.
print() on unopened filehandle >recipients at -e line 1, <> line 1228.
print() on unopened filehandle >recipients at -e line 1, <> line 1229.
print() on unopened filehandle >recipients at -e line 1, <> line 1232.

-- 
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--


More information about the spug-list mailing list