cztmonk has asked for the wisdom of the Perl Monks concerning the following question:
Good Morning Monks. I have a logfile containing
bla bla IP address:port bla bla IP address:port
I have this code to get the 1st IP/port. How do I get the 2nd one?
use strict; use warnings; use autodie; my @ipaddress; my $filename = "router.log"; my $myip = "10.0.0."; my $count = 0; open my $f, "<", $filename; while(<$f>){ $count++; while (/$myip/g){ if (m/(\d+\.\d+\.\d+\.\d+\:\d+)/){ push @ipaddress,$1; } } } close $f;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regexp question,get 2nd match
by johngg (Canon) on Jul 24, 2012 at 10:15 UTC | |
by cztmonk (Monk) on Jul 24, 2012 at 10:27 UTC | |
|
Re: Regexp question,get 2nd match
by davido (Cardinal) on Jul 24, 2012 at 11:12 UTC | |
|
Re: Regexp question,get 2nd match
by Corion (Patriarch) on Jul 24, 2012 at 09:57 UTC | |
|
Re: Regexp question,get 2nd match
by Ratazong (Monsignor) on Jul 24, 2012 at 10:56 UTC | |
|
Re: Regexp question,get 2nd match
by desemondo (Hermit) on Jul 24, 2012 at 09:59 UTC | |
by cztmonk (Monk) on Jul 24, 2012 at 10:08 UTC |