How to use dig with an ip list
Paul Schmehl
pauls at utdallas.edu
Tue Aug 19 03:52:12 UTC 2008
--On August 18, 2008 10:13:54 PM -0500 Jeffrey Goldberg
<jeffrey at goldmark.org> wrote:
> On Aug 18, 2008, at 9:03 PM, Paul Schmehl wrote:
>
>> I know I'm missing the obvious. I want to use an IP list to
>> generate an ip+hostname list. IOW, I want to go from this:
>>
>> x.x.x.x
>> y.y.y.y
>>
>> to this;
>>
>> x.x.x.x foo.domain.tld
>> y.y..y.y bar.domain.tld
>>
>> What's the best/easiest way to do this?
>
> Easiest:
>
> $ for i in `cat ip-list`; do
> > echo -n "$i "
> > dig +short -x $i
> > done
>
Don't know why I didn't think of that.
I ended up using this:
for ip in `cat public_linux_ips`; do echo ${ip} `dig +short -x ${ip}`;
done > public_linux_ips_resolved
Which gave me the output I wanted. Thanks for the pointer.
Paul Schmehl (pauls at utdallas.edu)
Senior Information Security Analyst
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/
More information about the freebsd-questions
mailing list