grep in Linux/Unix, find in Windows
Many times you might have wondering what is the command available in Windows which is equivalent for "grep" in Linux/Unix. You can use findstr command in Windows
grep
The grep command in Linux/Unix is one of the most used command. This is used for searching patterns in text. grep process text line by line and prints any line that matching the specified pattern. Regular Expressions can be used searching.
grep can be used in many scenarios.
Examples: Search for a file Starting with "XX" in a directory
$ ls | grep XX
List all files except file Starting with "XX" in a directory
$ ls | grep -v XX
Search for pattern in a file and list file names and lines
$ grep 187 *
Windows - findstr
findstr command in Windows can be used for similar purpose. Now let us see how above scenarios can be achieved using findstr command.
Examples: Search for a file Starting with "XX" in a directory
c:\ dir | findstr "XX"
List all files except file Starting with "XX" in a directory
c:\ dir | findstr /v "XX"
Search for pattern in a file and list file names and lines
c:\ findstr "Internal" *
There are more parameters that can be used in combination to get the output.