cipher has asked for the wisdom of the Perl Monks concerning the following question:
But I need information from other fields too. I tried the following command but there is no outputperl -nle ' print $1 if /name=(\w+)/' filename
Also tried.perl -nle ' print $1 $2 if /name=(\w+).*age=(\d+)/' filename
Help is appreciated.perl -nle ' print $1 if /name=(\w+)/ && print $2 if /age=(\d+)/' filen +ame
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: One Liner, print multiple regex matches
by toolic (Bishop) on Nov 16, 2012 at 21:45 UTC | |
by cipher (Acolyte) on Nov 16, 2012 at 22:24 UTC | |
|
Re: One Liner, print multiple regex matches
by kennethk (Abbot) on Nov 16, 2012 at 21:43 UTC | |
|
Re: One Liner, print multiple regex matches
by Kenosis (Priest) on Nov 16, 2012 at 22:51 UTC | |
by cipher (Acolyte) on Dec 18, 2012 at 22:45 UTC | |
by Kenosis (Priest) on Dec 18, 2012 at 23:13 UTC |