Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jan 2001 02:25:04 -0500
From:      "Ryan Masse" <rmasse@max-info.net>
To:        "Calvin" <calvin@mail.flyingcroc.net>
Cc:        "FreeBSD-Questions" <freebsd-questions@freebsd.org>
Subject:   Re: Perl - IP Address
Message-ID:  <01fd01c0787a$f78b0400$0600a8c0@Home>
References:  <Pine.BSF.4.21.0101051615000.30798-100000@gilliam.users.flyingcroc.net>

next in thread | previous in thread | raw e-mail | index | archive | help
/sbin/ifconfig | perl -pe 's/\s+inet ([0-9\.]*).*/$1\n/sg || s/.*//sg' |
mail -s 'output' user@domain
this will mail the output of the ifconfig with the inet search to an
specifies email addy

or you can

/sbin/ifconfig | perl -pe 's/\s+inet ([0-9\.]*).*/$1\n/sg || s/.*//sg' >>
output
this creates a seperate output file in which the contents of the search
results

From: "Calvin" <calvin@mail.flyingcroc.net>
To: "G D McKee" <freebsd@gdmckee.com>
Cc: "freebsd-questions" <freebsd-questions@FreeBSD.ORG>
Sent: Friday, January 05, 2001 7:35 PM
Subject: Re: Perl - IP Address


> They may not look pretty, but they work.
>
> To pull out the ip address, use ...
>
> \s+\w+\s+((?:\d+\S){3}\d+)(?:\s+\w+){3}\s+\S+
>
> and to pull out the interface, use ...
>
> ^(\w+)\:\s+flags.*$
>
> btw, this isn't really a FreeBSD question :-)
>
> > Hi
> >
> > Does any one have a regular expression that will pull out an IP Address
from
> > ifconfig.  A regular network interface and a reg ex for tun0 for dial
up?
> >
> > G D McKee
> >
> >
> >
> > To Unsubscribe: send mail to majordomo@FreeBSD.org
> > with "unsubscribe freebsd-questions" in the body of the message
> >
>
> _____________________________________________________________________
> Calvin M. Meloon Flying Crocodile, Inc
> System Admin   Seattle, WA
> Writer of code, Manipulator of Data Office: 206-374-0374
> Security, Backups, & Recovery    Cell: 206-255-8153
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
>
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01fd01c0787a$f78b0400$0600a8c0>