LANG=C ifconfig eth0 | grep "inet addr" | awk '{print $2}' | sed 's/addr://'
http://www.atmarkit.co.jp/flinux/rensai/iptables04/iptables03g.html
めも
http://d.hatena.ne.jp/gunshot/20080804より長いが分かりやすい。
LANG=C ifconfig eth0 | sed -n '/.*inet addr:\([0-9.]*\).*/{s//\1/;p}'
IPv6用動作未確認
LANG=C ifconfig eth0 | sed -n '/.*inet6 addr: \([0-9:a-f]*\).*/{s//\1/;p}'