in reply to Re^4: Extract lines between two patterns
in thread Extract lines between two patterns
I want to extract lines between Pattern1 and Pattern2 and write it into file2
untested
#!/usr/bin/perl use strict; use warnings; our $fh; our $log; open($fh,"<","block.power"); open ($log,">","temp.log") or die "can not open file $log : $!\n" ; while($fh){ if (/Pattern1>(.*?)<Pattern2/) { print $log $1; } } close $fh; close $log;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Extract lines between two patterns
by kielstirling (Scribe) on Jan 23, 2012 at 04:56 UTC | |
by mnithink (Initiate) on Jan 24, 2012 at 03:27 UTC | |
by Anonymous Monk on Oct 11, 2012 at 17:02 UTC | |
by Anonymous Monk on Oct 12, 2012 at 07:37 UTC | |
by Anonymous Monk on Oct 12, 2012 at 13:38 UTC |
In Section
Seekers of Perl Wisdom