uday_sagar has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, Here is the format of my text from which i need to grab some part of the text.
BEGIN hi abc def ghi jkl END BEGIN hello abc pqr stu mno END
As, you see above, each and every BEGIN has its own END, I want a snippet of the code from BEGIN hi to "its" END (not the end of "BEGIN hello"). The code i have written is shown below. But its pulling the lines from desired BEGIN to the END of the "other" BEGIN.
Any solution? Thanks in Advance, Uday Sagar.open DATA, "</hello.txt"; my @hello = <DATA>; foreach my $k (@hello) { if ($k=~/BEGIN ps7_slcr/../END/) { print $k; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading particular line which repeats itself many times in text
by choroba (Cardinal) on Jan 27, 2012 at 11:58 UTC | |
|
Re: Reading particular line which repeats itself many times in text
by toolic (Bishop) on Jan 27, 2012 at 13:26 UTC | |
|
Re: Reading particular line which repeats itself many times in text
by chessgui (Scribe) on Jan 28, 2012 at 08:30 UTC | |
by uday_sagar (Scribe) on Jan 31, 2012 at 04:35 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |