Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On linux I can list all entries in the DNS table ending with "80" using:

dig axfr my.domain | grep 80

How do I do that with NSlookup on windows? I have tried starting NSlookup and typing

ls my.domain

Which gives me the full list. But how do I filter the resultset like using grep on linux?

I have tried:

C:\Users\user>nslookup -ls my.domain | find "80"
*** Invalid option: ls

but it gives the above error.

share|improve this question
2  
I think it might be better to rephrase your question on how to get grep-like functionality in Windows. –  mtak Jul 18 at 11:43

2 Answers 2

I believe more elegant solution is to use powershell. It's certainly better than using Cygwin on a Windows machine - for one thing it's built-in.

In Bash we write:

dig axfr my.domain | grep "80"

The equivalent in Powershell would be:

nslookup -ls my.domain | where {$_ -match "80"}

Or even better to use regex to make sure only lines ending with 80 are going to be matched:

nslookup -ls my.domain | where {$_ -match "(80)$"}

Additionally if you are interested in domain zone transfers, you might find this answer useful (and here's a GitHub project).

share|improve this answer
    
It may be better than Cygwin, but Git Bash, for one, doesn't put all the bloat on your computer. Also, you don't need to install every single Cygwin package, just the ones you need. –  trysis Jul 18 at 18:30

I think what you're looking for is the find command.

nslookup -ls my.domain | find "80"

Note though that neither grep 80 nor find "80" will only return those entries ending in 80. They will both return entries that contain 80. If you truly only want entries that end in 80 it would be better to use findstr with the /e flag (matches the pattern if at the end of a line) as well as including a leading period (otherwise you might get something like 10.21.37.180).

nslookup -ls my.domain | findstr /e ".80"

You can also use Cygwin, which is "a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows."

EDIT

If nslookup -ls my.domain is giving you an error, then you might try

 echo ls my.domain | nslookup | find "80"

or if you really only want the ones that end in .80 try

 echo ls my.domain | nslookup | findstr /e ".80"
share|improve this answer
    
I did try that see edited post on windows 7 but it gives an error. I have bot tried from cmd and from a started instance of nslookup.exe –  u123 Jul 18 at 13:49
    
What version of Windows are you using? –  druciferre Jul 18 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.