----- Original Message ----- From: "KEVIN ZEMBOWER" <[EMAIL PROTECTED]> To: <beginners@perl.org> Sent: Thursday, August 18, 2005 1:06 AM Subject: Finding matches and use of __END__ in a one-liner
I have a series of EZMLM configuration files in the ~alias directory that look like this: main:/var/qmail/alias# cat cire/config F:-aBCdEFGHiJKlmnOpQrStuVWXYZ X: D:/var/qmail/alias/cire T:/var/qmail/alias/.qmail-cire L:cire H:infoforhealthx.org C: 0: 3: 4: 5: 6: 7: 8: 9: main:/var/qmail/alias# I want to find them all and output the L: (list name) and H: (host name) information like this for the above example: [EMAIL PROTECTED] I've tried this unsuccessfully: main:/var/qmail/alias# for x in `find -name config`; do { perl -ne "($name)=/L:(.*)$/; ($add)=/H:(.*)$/; __END__ { print [EMAIL PROTECTED]; }" $x; } done main:/var/qmail/alias# Any suggestions on the mistakes I've made? Thanks a lot for your advice and suggestions. -Kevin Zembower perl -ne '$name=$1 if /^L:(.*)$/; $add=$2 if /^H(.*)$/; END{print "[EMAIL PROTECTED]"}' $x -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>