Mac:
$ ifconfig en0|awk -F"[ ]+" '/inet/{print $2}'
fe80::a211:9bff:fe15:%en0
192.168.0.100
Ubuntu:
$ ifconfig eth0|awk -F"[: ]+" '/inet addr/{print $4}'
192.168.0.100
$ ifconfig eth0|awk -F"[ ]+" '/inet6 addr/{print $4}'
fe80::20c:16ff:fe4c:/
Mac:
$ ifconfig en0|awk -F"[ ]+" '/inet/{print $2}'
fe80::a211:9bff:fe15:%en0
192.168.0.100
Ubuntu:
$ ifconfig eth0|awk -F"[: ]+" '/inet addr/{print $4}'
192.168.0.100
$ ifconfig eth0|awk -F"[ ]+" '/inet6 addr/{print $4}'
fe80::20c:16ff:fe4c:/