It is fairly easy to obtain DNS information for a domain listed by name or IP address. You can use the following procedure regardless of what platform your DNS is running on. You can also use this to verify what names your DNS thinks it is resolving, since this won’t necessarily match your hosts file.
Here is an NT command prompt session that illustrates the process. All commands are built-in functions of NT. You could always edit gr.txt to get rid of the NS entry.
Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.
D:\>nslookup
Default Server: wormy.groceryshoppin.com
Address: 10.50.100.25
[Note: if the default server doesn’t have the records you want, type “server ” at the > prompt in nslookup.]
> ls -t groceryshoppin.com > gr.txt
[wormy.groceryshoppin.com]
Received 7 records.
> exit
D:\>type gr.txt
> ls -t groceryshoppin.com
[wormy.groceryshoppin.com]
groceryshoppin.com.NS server = wormy.groceryshoppin.com
pooldogA10.50.100.22
wormyA10.50.100.25
bruceleeA10.50.100.3
u-1A10.50.100.1
D:\>type gr.txt | sort /+2 > grsrt.txt
D:\>type grsrt.txt
> ls -t groceryshoppin.com
bruceleeA10.50.100.3
u-1A10.50.100.1
groceryshoppin.com.NSserver = wormy.groceryshoppin.com
pooldogA10.50.100.22
wormyA10.50.100.25
[wormy.groceryshoppin.com]
D:\>type gr.txt | sort /+40 > grsrt.txt
D:\>type grsrt.txt
[wormy.groceryshoppin.com]
> ls -t groceryshoppin.com
u-1A10.50.100.1
pooldogA10.50.100.22
wormyA10.50.100.25
bruceleeA10.50.100.3
groceryshoppin.com.NSserver = wormy.groceryshoppin.com
D:\>
Note that the listing sorted by IP address has the typical alphanumeric sort problem where .11 will come before .2. I’m sure there are more elegant ways to do this, but this is simple, generic, and works out of the box.