blackadder has asked for the wisdom of the Perl Monks concerning the following question:
What I want to capture is the data after the string 'show switchname ------------------' and before the line "****************************************************************** "#! c:/perl/bin/perl.exe # # $|++; AUTOLOAD; use strict; use warnings 'all'; my $Rec; while (<DATA>) { chomp; next if ($_ eq ""); $Rec->{$1} = $2 if ($_=~ /^-+\s+show (switchname)\s+-+\n(\w+)\*+/mg +); print "$Rec->{$1} = $2\n"; } close DATA; __DATA__ show tech-support details -------------------- show switchname ------------------ CCC217_ANG_GREEN ****************************************************************** show tech-support details -------------------- show switchname ------------------ CCC218_ANG_GREEN ****************************************************************** show tech-support details -------------------- show switchname ------------------ CCC219_ANG_GREEN ****************************************************************** show tech-support details -------------------- show switchname ------------------ CCC220_ANG_GREEN ******************************************************************
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with Multiple line RegEx
by GrandFather (Saint) on Oct 10, 2005 at 10:45 UTC | |
|
Re: Help with Multiple line RegEx
by wfsp (Abbot) on Oct 10, 2005 at 10:32 UTC | |
by blackadder (Hermit) on Oct 10, 2005 at 11:08 UTC | |
|
Re: Help with Multiple line RegEx
by reasonablekeith (Deacon) on Oct 10, 2005 at 10:47 UTC | |
by blackadder (Hermit) on Oct 10, 2005 at 11:35 UTC | |
|
Re: Help with Multiple line RegEx
by gargle (Chaplain) on Oct 10, 2005 at 10:57 UTC | |
by Skeeve (Parson) on Oct 10, 2005 at 11:13 UTC | |
by blackadder (Hermit) on Oct 10, 2005 at 11:32 UTC | |
by gargle (Chaplain) on Oct 10, 2005 at 11:55 UTC | |
|
Re: Help with Multiple line RegEx
by BrowserUk (Patriarch) on Oct 10, 2005 at 11:05 UTC | |
by blackadder (Hermit) on Oct 10, 2005 at 11:28 UTC | |
|
Re: Help with Multiple line RegEx
by Perl Mouse (Chaplain) on Oct 10, 2005 at 10:37 UTC |