Re: Unexepcted behavior from read and cat

2008-05-13 Thread Erik Osterholm
On Mon, May 12, 2008 at 12:22:48PM -0700, Johan Dowdy wrote: For loops are your friend. I'd do something like: for i in `cat iplist` do dig +short -x $I done Even better: while read i do dig +short -x $i done iplist See the Useless Use of Cat Award for more details. Erik

Re: Unexepcted behavior from read and cat

2008-05-13 Thread Jonathan McKeown
On Monday 12 May 2008 20:59, Paul Schmehl wrote: 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.) [snip] WTF? Why do these utilities, which usually read all the lines in a file now only work once when run through dig? Is

Re: Unexepcted behavior from read and cat

2008-05-13 Thread Jonathan McKeown
On Tuesday 13 May 2008 18:23, Jonathan McKeown wrote: The comedy solution: lam -s '-x ' trydata | xargs dig +short and of course I meant iplist, not trydata: this was a cut'n'paste, and trydata is my scratch test data filename (often providing input to a script called try. Why isn't it

Re: Unexepcted behavior from read and cat

2008-05-13 Thread Johan Dowdy
I think this one wins for brevity. On 5/12/08 1:55 PM, RW [EMAIL PROTECTED] wrote: On Mon, 12 May 2008 14:08:06 -0500 Paul Schmehl [EMAIL PROTECTED] wrote: --On Monday, May 12, 2008 13:59:47 -0500 Paul Schmehl [EMAIL PROTECTED] wrote: Sure, I can edit the file and prepend +short -x to

Re: Unexepcted behavior from read and cat

2008-05-13 Thread Jonathan McKeown
[respecting Time's arrow] On Tuesday 13 May 2008 20:55, Johan Dowdy wrote: On 5/12/08 1:55 PM, RW [EMAIL PROTECTED] wrote: cat iplist | xargs -n1 dig +short -x I think this one wins for brevity. It can be made shorter: iplist xargs -n1 dig +short -x but it fires off multiple dig

Unexepcted behavior from read and cat

2008-05-12 Thread Paul Schmehl
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

Re: Unexepcted behavior from read and cat

2008-05-12 Thread Paul Schmehl
--On Monday, May 12, 2008 13:59:47 -0500 Paul Schmehl [EMAIL PROTECTED] wrote: 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? Never mind. This worked. (read line; dig +short -x `echo $line`; while read

Re: Unexepcted behavior from read and cat

2008-05-12 Thread Chuck Swiger
On May 12, 2008, at 11:59 AM, Paul Schmehl wrote: 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? The dig which comes with BIND 9

Re: Unexepcted behavior from read and cat

2008-05-12 Thread Mario Lobo
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 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.

Re: Unexepcted behavior from read and cat

2008-05-12 Thread Johan Dowdy
For loops are your friend. I'd do something like: for i in `cat iplist` do dig +short -x $I done -J On 5/12/08 11:59 AM, Paul Schmehl [EMAIL PROTECTED] wrote: dig +short -x `cat iplist` -- Johan Dowdy - CISSP Senior Systems Administrator nCircle Network Security 415.318.2880 Any

Re: Unexepcted behavior from read and cat

2008-05-12 Thread RW
On Mon, 12 May 2008 14:08:06 -0500 Paul Schmehl [EMAIL PROTECTED] wrote: --On Monday, May 12, 2008 13:59:47 -0500 Paul Schmehl [EMAIL PROTECTED] wrote: 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