Help scripting dns lookup using awk

Tim Daneliuk tundra at tundraware.com
Fri Sep 15 01:58:46 UTC 2017


On 09/14/2017 07:55 PM, Ernie Luzar wrote:
> The following sh script works, but runs very slow.
Rudiments of the same thing in Python (spacing and indents matter):

#!/usr/bin/env python
# Return IP Of Hostnames Specified On Commandline

from socket import gethostbyname
from sys    import argv

for host in argv[1:]:
    try:
        print gethostbyname(host), " " * 8, host

    except:
        print "Invalid Hostname: %s" % host


----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the freebsd-questions mailing list