From owner-freebsd-questions@FreeBSD.ORG Mon May 12 18:59:48 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F5001065672 for ; Mon, 12 May 2008 18:59:48 +0000 (UTC) (envelope-from pauls@utdallas.edu) Received: from smtp3.utdallas.edu (smtp3.utdallas.edu [129.110.20.110]) by mx1.freebsd.org (Postfix) with ESMTP id F12248FC31 for ; Mon, 12 May 2008 18:59:47 +0000 (UTC) (envelope-from pauls@utdallas.edu) Received: from utd65257.utdallas.edu (utd65257.utdallas.edu [129.110.3.28]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp3.utdallas.edu (Postfix) with ESMTPSA id 5F1C423DF3 for ; Mon, 12 May 2008 13:59:47 -0500 (CDT) Date: Mon, 12 May 2008 13:59:47 -0500 From: Paul Schmehl To: FreeBSD Questions Message-ID: X-Mailer: Mulberry/4.0.8 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Unexepcted behavior from read and cat X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 May 2008 18:59:48 -0000 I created a small list of IPs that I wanted to do digs on (because I'm lazy and don't want to do them one at a time.) I then wrote the following on the commandline: % dig +short -x `cat iplist` The results was an answer for the first line only. So, I thought read line would do the trick. I tried this: % dig +short -x `(read line; echo $line; while read line; do echo $line; done) < iplist` Same result. I even tried: % dig +short -s `cat iplist | awk '{print $1}'` Same result. (Yes, I know, why do twice the work to get the same answer, but I was desperate.) WTF? Why do these utilities, which usually read all the lines in a file now only work once when run through dig? Is there a way to feed dig a list of IPs and have it return each and every one of them? I tried dig +short -x -f iplist, but that returns nothing at all. Sure, I can edit the file and prepend +short -x to each line, but by then I might as well just do them individually. What am I missing? -- Paul Schmehl (pauls@utdallas.edu) Senior Information Security Analyst The University of Texas at Dallas http://www.utdallas.edu/ir/security/