On 19 Nov 2002, Bryan Simmons wrote:

> I have an adsl connection that uses a dynamic IP from my ISP.  I use the
> adsl-status script to find out what my IP is at any time.
> What I want to do is parse the response I get from adsl-status to
> isolate my IP.  Here is the output of the adsl-status script:
>
> adsl-status: Link is up and running on interface ppp0
> ppp0      Link encap:Point-to-Point Protocol
>           inet addr:151.196.10.63  P-t-P:10.4.25.1  Mask:255.255.255.255
>           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
>           RX packets:1962 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:1987 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:3
>           RX bytes:1600510 (1.5 Mb)  TX bytes:362634 (354.1 Kb)
>
> I figured that by using this command:  adsl-status | grep -o
> addr:['0'-'9']

adsl-status | grep inet | awk '{print $2}' | awk -F\: '{print $2}'

This grep's for the inet addr line.  Then awk takes word #2.  Then tells
awk that : is the seperator instead of space, and take word #2 again.

This _should_ work, it worked with ifconfig ppp0 here, which is what that
adsl-status seems to be calling.

Mike

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to