/sbin/ifconfig eth0 | awk '/^ +inet addr:/ { split($2, a, ":"); print a[2] } or /sbin/ifconfig eth0 | sed -ne 's,^.*inet addr:\([0-9.]*\).*,\1,p'