Front page | perl.beginners |
Postings from February 2002
RE: Reg Exp help
Thread Previous
|
Thread Next
From:
Daryl J. Hoyt
Date:
February 26, 2002 06:40
Subject:
RE: Reg Exp help
Message ID:
NEBBJLDJCJIGAJNJNLNMMECJDAAA.daryl.hoyt@geodesic.com
If there is only one of the lines |GRP| this will work. Otherwise I would
push the lines into a an array instead of a variable.
@Out = `$Cmd`;
$WhatFollowsGRP = "";
foreach my $line (@Out)
{
if($line =~ /|GRP|/)
{
$line =~ s/|GRP|//;
$WhatFollowsGRP = $line;
}# end if
}# end foreach loop
Daryl J. Hoyt
Performance Engineer
Geodesic Systems
312-832-2010
<http://www.geodesic.com>
<mailto:djh@geodesic.com>
-----Original Message-----
From: Busse, Rich [mailto:BusseR@DNB.com]
Sent: Tuesday, February 26, 2002 8:35 AM
To: Perl Beginners
Subject: Reg Exp help
I am capturing the output of a command in a string:
$Out = `$Cmd` ;
The output always looks like:
List of Templates and Template Groups assigned to 'somenode.us.dnb.com':
====================================================================
|GRP| SBS-DSM
====================================================================
Operation successfully completed.
It's always on 5 separate lines. How do I extract what follows |GRP| on the
third line to a variable? TIA...
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
Thread Previous
|
Thread Next