Andre Venter wrote:
> If you're just looking for IP Address, what does ifconfig (No switches) show
> ?
>
> O.K so how do I parse the ip address from this. The idea is that I will call
> a script every time you open a local Xterm to give me my IP. I have tried
echo `~corcoraj/bin/ifconfig -a|grep addr:| sed "/^inet addr:/,/^B/"`:0
So for a given output
eth0 Link encap:Ethernet HWaddr 00:50:04:54:22:69
inet addr:158.234.99.62 Bcast:158.234.99.255 Mask:255.255.252.0
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:1131214 errors:0 dropped:0 overruns:8 frame:0
TX packets:42005 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:10 Base address:0x1080
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:46 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
I firstly grep the highlighted line. And I have removed the inetaddr: bit, But
how do I parse the remainder.
Thanks.
Jason.
>> -----Original Message-----
> From: ilug-admin at linux.ie [mailto:ilug-admin at linux.ie]On Behalf Of Jason
> Corcoran
> Sent: Tuesday, September 05, 2000 12:39 PM
> To: ILinux
> Subject: [ILUG] IP address
>> Hi there,
>> I connect ot my network using dhcpc, under SuSE I used to parse
> /etc/dhcpc/dhcpcd-eth0.info for my ip address. Where is this file under
> Red Hat ?? I can't seem to find it anywhere, besides doing a grep
> -R from root for my ip address.
>> Thanks.
>> Jason.
>> --
> _________________________________________
> Jason Corcoran.
> SIT Core Team Leader.
> Logica.
> Wireless Data Division.
> Plaza 5.
> Harbour Master Place.
> Dublin 1.
>> Phone: +353 (0)1 8193779.
> _________________________________________
> Linux is Like a WigWam No Gates, No Windows Just an Apache inside :o)
>> --
> Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie>> --
> Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie
--
_________________________________________
Jason Corcoran.
SIT Core Team Leader.
Logica.
Wireless Data Division.
Plaza 5.
Harbour Master Place.
Dublin 1.
Phone: +353 (0)1 8193779.
_________________________________________
Linux is Like a WigWam No Gates, No Windows Just an Apache inside :o)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!