Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Sep 2017 20:58:35 -0500
From:      Tim Daneliuk <tundra@tundraware.com>
To:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Help scripting dns lookup using awk
Message-ID:  <37196f51-3e6f-78fb-74fb-d69b0c555904@tundraware.com>
In-Reply-To: <59BB24E4.6060908@gmail.com>
References:  <59BB24E4.6060908@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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@tundraware.com
PGP Key:         http://www.tundraware.com/PGP/




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?37196f51-3e6f-78fb-74fb-d69b0c555904>