in reply to Re: Extract lines between two patterns
in thread Extract lines between two patterns
Thanks for the reply
First I experimented with this below code on a single file.
This worked for me. But my actual intent is to do this in a loop on multiple files. My code looks as belowperl -ne 'print if /Pattern1/ .. /Pattern2/' file1
when i execute this code, i'm getting below message#!/usr/bin/perl use strict; use warnings; our $fh; our $log; open($fh,">","file1"); open ($log,">","file2") or die "can not open file $log : $!\n" ; while($fh){ if (/Pattern1 .. /Pattern2/) {printf $log;} }
"Use of uninitialized value in pattern match (m//) at temp.pl line 11. +"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Extract lines between two patterns
by philipbailey (Curate) on Jan 22, 2012 at 08:39 UTC | |
|
In Section
Seekers of Perl Wisdom