John, thank you so much for both your suggestions. Even though Manav's suggestions work, I learned a little more perl looking up the parts I didn't understand in your suggestions. With just a slight modification, both of these worked:
perl -l -0777ne'print /L:(.+)\s/, q/@/, /H:(.+)\s/' `find -name config` perl -l -0777ne'$_ = join q/@/, /L:(.+)\s/, /H:(.+)\s/ and print' `find -name config` I had to remove the ^ anchor, because, when treating the whole file as a string (-l -0777), 'L:' and 'H:' are no longer at the beginning of the string. I also thought that I had to put in the '\s' space delimiter, but just now running them without the two occurrences of '\s' doesn't make any difference. Hmm, more to study... Thank you again for your suggestion, and for teaching me more perl. -Kevin Zembower >>> "John W. Krahn" <[EMAIL PROTECTED]> 08/17/05 08:10PM >>> John W. Krahn wrote: > KEVIN ZEMBOWER wrote: >>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? > > > perl -l -0777ne'print /^L:(.+)/, q/@/, /^H:(.+)/' `find -name config` This may work a bit better: perl -l -0777ne'$_ = join q/@/, /^L:(.+)/, /^H:(.+)/ and print' \ `find -name config` :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>