Linuxathome.net
https://forum.linuxathome.net/

Extracting adapter address
https://forum.linuxathome.net/viewtopic.php?f=3&t=118
Page 1 of 1

Author:  DagdaMor [ Tue Oct 15, 2002 5:48 pm ]
Post subject:  Extracting adapter address

Does anyone have a nice way to extract the ip address associated with an adapter in a shell script??

Thanks

Author:  redlander [ Tue Oct 15, 2002 6:22 pm ]
Post subject: 

ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | sed -e "s/addr\://"
or for some basic numeric checking
ifconfig eth0 | sed -n 's/inet addr: *\([0-9.]*\).*/\1/p' | awk '{print $1}'

Author:  DagdaMor [ Tue Oct 15, 2002 6:43 pm ]
Post subject: 

I really should learn to use pattern matching tools properly :roll:

Thanks redlander

Page 1 of 1 All times are UTC + 10 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/