Hello All,
Can someone show me how to cat "only the IP address of e1000g0" using ifconfig -a.
i am trying to grep only the ip address (xx.xx.xx.xx) from the bunch of all other things like, broadcast address, IPV4, UP........and so on.
thanks
Hello All,
Can someone show me how to cat "only the IP address of e1000g0" using ifconfig -a.
i am trying to grep only the ip address (xx.xx.xx.xx) from the bunch of all other things like, broadcast address, IPV4, UP........and so on.
thanks
Try this:
ifconfig -a | awk '/e1000g0/{p=1}p&&/inet addr/{sub(".*:", "", $2);print $2;exit}'
Use nawk or /usr/xpg4/bin/awk on Solaris.