gcazianfnf has asked for the wisdom of the Perl Monks concerning the following question:
I want to extract the IP address with the following code:root>$ lsattr -El en0|grep "Internet Address" netaddr 10.1.4.43 Internet Address True
However, the value for $1 is null. Is my regexp pattern wrong?my $ipadd = `lsattr -El en0|grep "Internet Address"`; chomp($ipadd); if ($ipadd =~ m/^([0-255].[0-255].[0-255].[0-255])+/) { $ipaddress = $1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp for extracting IP address
by hardburn (Abbot) on Oct 11, 2004 at 20:32 UTC | |
|
Re: regexp for extracting IP address
by BUU (Prior) on Oct 11, 2004 at 20:33 UTC | |
|
Re: regexp for extracting IP address
by Roy Johnson (Monsignor) on Oct 11, 2004 at 20:34 UTC | |
|
Re: regexp for extracting IP address
by skx (Parson) on Oct 11, 2004 at 20:37 UTC | |
by cLive ;-) (Prior) on Oct 11, 2004 at 21:53 UTC | |
|
Re: regexp for extracting IP address
by reneeb (Chaplain) on Oct 12, 2004 at 08:35 UTC |