From owner-freebsd-questions@freebsd.org Fri Sep 15 01:58:46 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FB55E1C2D2 for ; Fri, 15 Sep 2017 01:58:46 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from oceanview.tundraware.com (oceanview.tundraware.com [45.55.60.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailman.tundraware.com", Issuer "mailman.tundraware.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C4ADE72F04 for ; Fri, 15 Sep 2017 01:58:45 +0000 (UTC) (envelope-from tundra@tundraware.com) Received: from [192.168.0.2] (ozzie.tundraware.com [75.145.138.73]) (authenticated bits=0) by oceanview.tundraware.com (8.15.2/8.15.2) with ESMTPSA id v8F1wfuU082864 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Thu, 14 Sep 2017 20:58:42 -0500 (CDT) (envelope-from tundra@tundraware.com) Subject: Re: Help scripting dns lookup using awk To: FreeBSD Mailing List References: <59BB24E4.6060908@gmail.com> From: Tim Daneliuk Message-ID: <37196f51-3e6f-78fb-74fb-d69b0c555904@tundraware.com> Date: Thu, 14 Sep 2017 20:58:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <59BB24E4.6060908@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (oceanview.tundraware.com [45.55.60.57]); Thu, 14 Sep 2017 20:58:42 -0500 (CDT) X-TundraWare-MailScanner-Information: Please contact the ISP for more information X-TundraWare-MailScanner-ID: v8F1wfuU082864 X-TundraWare-MailScanner: Found to be clean X-TundraWare-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-0.919, required 1, autolearn=not spam, ALL_TRUSTED -1.00, AWL 0.08, RP_MATCHES_RCVD -0.00) X-TundraWare-MailScanner-From: tundra@tundraware.com X-Spam-Status: No X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 01:58:46 -0000 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/