On Mon, Aug 18, 2008 at 10:05:18PM -0500, Paul Schmehl wrote: > --On August 19, 2008 12:44:05 PM +1000 Fraser Tweedale <[EMAIL PROTECTED]> > wrote: > > > On Mon, Aug 18, 2008 at 09:03:36PM -0500, 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? > >> > >> Paul Schmehl ([EMAIL PROTECTED]) > >> Senior Information Security Analyst > >> The University of Texas at Dallas > >> http://www.utdallas.edu/ir/security/ > > > > dig(1) - see section `MULTIPLE QUERIES' > > note the -x flag to instruct dig to perform a reverse lookup > > > > see also host(1) > > > > That's not a great deal of help. I, of course, had read and re-read the > man pages before posting the question here, and I'm quite familiar with > the "normal" use of dig and host, because I use them daily in my work. > > The two options that man (1) dig provides are; on the commandline and in a > file. I can easily generate a list of hostnames having constructed an > iplist in a file and then preceding each line with "dig +short -x IP" > using vi. But that gives me a list of hostnames only. What I'm looking > for is the combination of the two. host (1), of course, doesn't even have > *those* options, so it's of no use for accomplishing what I'm attempting. > > Again, I want to start with a list of IPs and end up with a list of IPs > *plus* their hostnames (on the same line). I'm quite sure someone here > has the experience and/or knowledge to do this using shell commands. I > suspect awk might be helpful but haven't yet investigated that angle. > > Paul Schmehl ([EMAIL PROTECTED]) > Senior Information Security Analyst > The University of Texas at Dallas > http://www.utdallas.edu/ir/security/
how about ================================== #!/bin/sh while read LINE do echo $LINE `dig +short -x $LINE` done =================================== whack that in a file, chmod +x it and cat in the IPs HTH frase
pgpUcTGrjq53p.pgp
Description: PGP signature