Re: A multi line pattern match question

2016-07-14 Thread Andrew Solomon
Hi Darryl After all that I must confess that when I'm making config changes to multiple servers, I use Rex: http://rexify.org/ https://metacpan.org/pod/Rex which is something like Puppet-lite:) Andrew On Thu, Jul 14, 2016 at 11:04 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
I settled for an set of stacked if statements, saving the previous line if needed etc... Thanks for the help. Darryl Baker PMOET -DAPS X76674

Re: A multi line pattern match question

2016-07-14 Thread Charles DeRykus
One easier approach: use Tie::File; tie( my @array, 'Tie::File', "/path/to/file" ) or die $!; my $n = 0; while ( $n <= $#array ) { if ( $array[$n] =~ /.*[Oo]rder deny,allow(.*)/ and $n < $#array and $array[$n+1] =~ /[\Dd]eny from all(.*)/ ) { $n

Re: A multi line pattern match question

2016-07-14 Thread Omega -1911
On Thu, Jul 14, 2016 at 2:56 PM, Rob McAninch wrote: > > > On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > >> On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < >> darryl.ba...@northwestern.edu> wrote: >> >> While not truly a beginner it feels

Re: A multi line pattern match question

2016-07-14 Thread Rob McAninch
On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many yea

Re: A multi line pattern match question

2016-07-14 Thread Omega -1911
On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many yea

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker wrote: While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert t

Re: A multi line pattern match question

2016-07-14 Thread Rob McAninch
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many years. > > I currently need a program to take Apache HTTPD configuration files in > HTTPD 2.2 syntax u

A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert them to HTTPD 2.4 syntax in future production. I will need to

Re: A multi line pattern match question

2016-07-14 Thread Andrew Solomon
I'm guessing the problem is the newline in the regex. If you want it to match across multiple lines, I think the /ms modifiers should do the trick. if ( m/{.*}[Oo]rder deny,allow(.*)\n(.*)[Dd]eny from all(.*)/ms) { NOTE: I haven't tried this myself!:) failing that, $ perldoc perlre may be o