[Techtalk] Discovering my IP address

John Clarke johnc+linuxchix at kirriwa.net
Mon Mar 15 16:43:21 EST 2004


On Sun, Mar 14, 2004 at 07:53:18PM -0800, Carla Schroder wrote:
> On Sunday 14 March 2004 7:43 pm, John Clarke wrote:
> > 
> > /sbin/ifconfig eth1|awk '$0 ~ /inet addr:/ {sub(/addr:/,"",$2); print $2}'
> > 
> Anyone care to contribute a nice 50-line Perl script to do the same thing?

Will one line do?:

    /sbin/ifconfig eth1|perl -ne 'print $1, "\n" if /inet addr:([0-9\.]+)/'

:-)



Cheers,

John
-- 
I use shell scripts at ork. Some cow-orkers refuse to touch them, their
excuse is usually "I don't understand perl".  Their fear of perl is such
that all things unknown are also perl.
            -- Andrew Dalgleish


More information about the Techtalk mailing list