From owner-freebsd-questions@FreeBSD.ORG Mon May 12 19:10:19 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 E82341065674 for ; Mon, 12 May 2008 19:10:19 +0000 (UTC) (envelope-from mario.lobo@ipad.com.br) Received: from ipad.com.br (recife.ipad.com.br [200.249.204.129]) by mx1.freebsd.org (Postfix) with SMTP id BC0D18FC2A for ; Mon, 12 May 2008 19:10:17 +0000 (UTC) (envelope-from mario.lobo@ipad.com.br) Received: (qmail 6629 invoked by uid 1008); 12 May 2008 19:10:05 -0000 Received: from unknown (HELO lobo.ipad.com.br) (mario.lobo@ipad.com.br@192.168.64.1) by ipad.com.br with SMTP; 12 May 2008 19:10:05 -0000 From: Mario Lobo Organization: IPAD To: freebsd-questions@freebsd.org Date: Mon, 12 May 2008 16:11:01 -0300 User-Agent: KMail/1.9.7 References: In-Reply-To: X-Face: ,55PTLsK{\?org*WH[[%>IJpi}pb?lwVxsDL<:}(Ti2yN(w/k\"enXx"?CbN[hp Subject: Re: 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 19:10:20 -0000 On Monday 12 May 2008, Paul Schmehl wrote: > I created a small list of IPs that I wanted to do digs on (because I'm la= zy > 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 li= st > 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? Why not: for ips in `cat iplist` do dig +short -x $ips done =2D-=20 Mario Lobo Seguran=E7a de Redes - Desenvolvimento e An=E1lise IPAD - Instituto de Pesquisa e Apoio ao Desenvolvimento Tecnol=F3gico e=20 Cient=EDfico