Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://838904]
[marto]: some err interesting variable names there

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-03-27 10:11 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (319 votes). Check out past polls.