Filtering

Hi
I am interested in DNS resolving a set of sites and each time the output is different-

$ host www.yahoo.com
www.yahoo.com is an alias for fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com is an alias for ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com is an alias for ds-eu-fp3-lfb.wa1.b.yahoo.com.
ds-eu-fp3-lfb.wa1.b.yahoo.com is an alias for ds-eu-fp3.wa1.b.yahoo.com.
ds-eu-fp3.wa1.b.yahoo.com has address 87.248.112.181
ds-eu-fp3.wa1.b.yahoo.com has address 87.248.122.122
ds-eu-fp3.wa1.b.yahoo.com has IPv6 address 2a00:1288:f00e:1fe::3000
ds-eu-fp3.wa1.b.yahoo.com has IPv6 address 2a00:1288:f006:1fe::3001
ds-eu-fp3.wa1.b.yahoo.com has IPv6 address 2a00:1288:f00e:1fe::3001
ds-eu-fp3.wa1.b.yahoo.com has IPv6 address 2a00:1288:f006:1fe::3000
$ host www.google.com
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 173.194.71.104
www.l.google.com has address 173.194.71.106
www.l.google.com has address 173.194.71.105
www.l.google.com has address 173.194.71.99
www.l.google.com has address 173.194.71.103
www.l.google.com has address 173.194.71.147
www.l.google.com has IPv6 address 2a00:1450:400f:801::1012

I want to format whatever I get as output to something like this-

www.google.com 173.194.71.104
www.yahoo.com 87.248.112.181

i am interested in the first IP that I get.

How do I do this :wall:
Thanks in advance.

---------- Post updated at 10:49 AM ---------- Previous update was at 10:47 AM ----------

Should have thought more before posting.

Solved it guys. Thanks.

host www.yahoo.com | sed '/has address/!d' | awk '{ if (NR == 1 ) { print ($4)} }'

Any better solutions?

host www.yahoo.com|awk '/has address/ {print $4;exit}'