On 08/03/2012 17:03, sunita.prad...@emc.com wrote:
Hi All

I have one output of one my command like :

$output = "Step 155 of 171 steps.....................................Executing.
     Step 168 of 171 steps.....................................Executing.
     Step 171 of 171 steps.....................................Executing.
     Local:  COMMIT............................................Done.

       New symdev:  2552
       New symdev:  2553
     Terminating the configuration change session..............Done." ;

I need to get those numbers like 2552 , 2553 .

I am applying following patter matching logic but it does not get me the  1st 
number (2552) .

@devs = $output =~ m/New symdev:\s*([0-9A-Fa-f]{4})/gis;
                         print $output,"\n";
                         print "Devices>>>>  @devs<<<<<<<<<\n";


Could you please check what is going  wrong in  the above lines ?

I am no sure what you mean Sunita. I have run your program and the
output is

  Devices >>>> 2552 2553 <<<<<<<<<

as I would expect.

All I can see is that you don't need the /s modifier as you aren't using
/./ anywhere in your regex; and with the /i modifier you can shorten
your character class to [0-9a-f], or you could write [[:xdigit:]].
Neither of these will change the functionality of your program though -
I think it's fine.

Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to