Quote Originally Posted by Khayyam View Post
necromancy .. mia culpa!

I see alot of 'grep | cut | awk' etc .. all of this can by achieved with one command:

Code:
awk '/inet addr:/{print (substr($2,6,15))}' <(ifconfig eth0)
or similarly to preface it with 'eth0 IP:'

Code:
awk '/inet addr:/ {print "eth0 IP: "(substr($2,6,15))}' <(ifconfig eth0)
HTH ... khay
Why invoking awk or any external command if plain POSIX shell already can do this:

Code:
ifconfig eth0|{ IFS=' :';read r;read r r a r;echo $a;}
or similarly to preface it with 'eth0 IP:'

Code:
ifconfig eth0|{ IFS=' :';read r;read r r a r;echo "eth0 IP: $a";}
Ciao - linuxball