Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: multiple regexp matches in multi line string

by k_manimuthu (Monk)
on May 07, 2010 at 10:12 UTC ( #838904=note: print w/ replies, xml ) Need Help??


in reply to multiple regexp matches in multi line string

For your code, you used the greedy match (.*). You will use the non-greedy match (.*?) in your code, you will get all the addresses.

while($lines =~ m/traffic-gen.*?client address = 192\.0\.0\.(\d+).*?da +ta units received = (\d+).*?jitter/scgi) { print $1, "\tyes\t",$2,"\n"; push @ones, $1; push @twos, $2; }

Replies are listed 'Best First'.
Re^2: multiple regexp matches in multi line string
by wirelesscharlie (Initiate) on May 10, 2010 at 06:38 UTC
    Yes that worked!! Thanks :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://838904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2016-06-30 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (396 votes). Check out past polls.