bigswifty00000 has asked for the wisdom of the Perl Monks concerning the following question:
Hey All!
I am trying to check a config file for the existence and settings of two parameters.
I believe it requires a logical AND.
I realize that this is checking for an AND on the same line,
perl -nle 'print $ARGV if !$seen{$ARGV}++ ;print if /^JRECOV="yes"/|/^TEOJ=-w"/' *
ALSO printing the filename only if BOTH conditions are met.
I can't seem to find the regex that will work for this, any help would be greatly appreciated.
Thanks!
BigSwifty00000
Sorry, I realized my LAST test was with an OR, after I posted.
Carry on!
BigSwifty0000
I corrected the missing " and tried this (this file has the 2 params set to what I'm searching for)
perl -nle 'print $ARGV if !$seen{$ARGV}++ ;print if /^JRECOV="yes"/&&/^TEOJ="-w"/' ss1lab02
AND
perl -n00 -le 'print $ARGV if !$seen{$ARGV}++ ;print if /^JRECOV="yes"/ms &&/^TEOJ="-w"/ms' ss1lab02
Neither is returning the lines (filename is returned)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multiple regex logical AND
by brian_d_foy (Abbot) on Dec 12, 2006 at 21:25 UTC | |
by bigswifty00000 (Beadle) on Dec 13, 2006 at 16:57 UTC | |
|
Re: multiple regex logical AND
by liverpole (Monsignor) on Dec 12, 2006 at 19:28 UTC | |
|
Re: multiple regex logical AND
by shmem (Chancellor) on Dec 12, 2006 at 19:05 UTC | |
by bigswifty00000 (Beadle) on Dec 12, 2006 at 20:22 UTC | |
by Joost (Canon) on Dec 12, 2006 at 20:24 UTC | |
by bigswifty00000 (Beadle) on Dec 12, 2006 at 20:30 UTC | |
by shmem (Chancellor) on Dec 12, 2006 at 22:26 UTC | |
|
Re: multiple regex logical AND
by ikegami (Patriarch) on Dec 12, 2006 at 20:41 UTC | |
by bigswifty00000 (Beadle) on Dec 13, 2006 at 17:03 UTC | |
by ikegami (Patriarch) on Dec 13, 2006 at 17:14 UTC | |
|
Re: multiple regex logical AND
by lin0 (Curate) on Dec 12, 2006 at 19:22 UTC | |
by liverpole (Monsignor) on Dec 12, 2006 at 19:30 UTC | |
by MidLifeXis (Monsignor) on Dec 13, 2006 at 18:46 UTC |