There are already a few days that I am searching the Internet for such a response but I have not gotten any so far. I'm trying to figure out ifconfig's Global IPv6 to be used on MOTD on Ubuntu.
With IPv4 it was quite easy to do this with this command, since there is only one IPv4 in inet.
root@gamerno:/home/stalker# ifconfig | grep 'inet' -m1 | awk {'print $2'}
192.168.254.254
For inet6 there are 3 IPv6: local link, global link and loopback.
root@gamerno:/home/stalker# ifconfig | grep 'inet6' | awk {'print $2'}
fe80::222:4dff:feae:31fb < link local
b00b:cafe:face:628b::dead:beef < link global
::1 < loopback
Remembering that the Global link is in the second line.