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:[EMAIL PROTECTED]> -----Original Message----- From: Busse, Rich [mailto:[EMAIL PROTECTED]] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]