Grep like command in Windows?

In Linux & Unix, I find that I use the grep command to filter the information by different utilities that returns more then a screen full of information.  For example using netstat, normally I want to view only the connections to a certain port numbers. Below is an example in Linux.

Linux Grep Results

I need to do the same type of filtering in the Windows Command Prompt.  Using the Windows “find” command, I am able to filter the results with something similar to the grep command in Linux/Unix.  In the example below, I want to see only those lines from the netstat utility that have the port number 1433.  I am able to pipe the results to the “find” command for the string 1433.

An important difference with the “find” command is that I must have my filtering string in double quotes. Example: netstat -an | find “1433”

Windows Netstat Find Results

netstat -an | find “1433”

The find command does not have all the functionality of the grep command.  However 90% of what I use in the grep command, I am able to accomplish with the “find” command.  For example,  I am able to filter the utility “tasklist” to return only the information on the services or processes that I am interested in seeing.

Windows Tasklist Find Results

tasklist | find “sql”

For the Powershell Console window:

findstr

netstat -an | findstr “1433”

In the PowerShell Console window, the find command will not work.  The “findstr” does the same thing as the “find” in the command prompt.

1 Comment

Leave a Comment