On Feb 26, Busse, Rich said: > $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...
You could use this: ($text) = `$Cmd` =~ /^\|GRP\|\s*(.*)/m; Let me expand that regex for you: m{ ^ # the start of a "line" \|GRP\| # the text '|GRP' \s* # any whitespace following it (.*) # the rest of the line (non-newline characters) }m # make ^ match at the beginning of a "line" You could also use `$Cmd` =~ /\n\|GRP\|\s*(.*)/; which works almost exactly the same way. Or, if you know it'll always be the third line... ($text) = (`$Cmd`)[2] =~ /\|GRP\|\s*(.*)/; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]