IP address to host name conversion

hi,

i want to get the hostname for the specified IP address.

# host www.google.com
www.google.com has address 173.194.69.104
www.google.com has address 173.194.69.105
www.google.com has address 173.194.69.106
www.google.com has address 173.194.69.147
www.google.com has address 173.194.69.99
www.google.com has address 173.194.69.103

# host 173.194.69.99
99.69.194.173.in-addr.arpa domain name pointer bk-in-f99.1e100.net.

Is there any way to get host name as "www.google.com" for the given IP address (173.194.69.99)?

"gethostbyaddr" function also returns same host name(bk-in-f99.1e100.net.) as above but i want "www.google.com" as the host name.

thanks in advance:)

Regards,
kavitha

Something like this?

awk '$NF=="173.194.69.99"{print $1}' host_file

No, actually "173.194.69.99" belongs to google then ,why are we not getting www.google.com as host name other than internal name "bk-in-f99.1e100.net."
is there any function to get actual host names?

I don't think there is a way. It is up to google what PTR records they provide for reverse lookups. You could use whois to try and find the IP-address owner..