develooper Front page | perl.beginners | Postings from February 2002

RE: Reg Exp help

Thread Previous | Thread Next
Daryl J. Hoyt
February 26, 2002 06:40
RE: Reg Exp help
Message ID:
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

-----Original Message-----
From: Busse, Rich []
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 '':
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:
For additional commands, e-mail:

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About