How to use dig with an ip list

Jeffrey Goldberg jeffrey at goldmark.org
Tue Aug 19 03:30:57 UTC 2008


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

Better might be to use something in p5-net-DNS so that you don't make  
N separate calls to dig.

Cheers,

-j



-- 
Jeffrey Goldberg                        http://www.goldmark.org/jeff/



More information about the freebsd-questions mailing list