Findstr for Windows 10 – Locate Strings in Files with CLI (Grep Alternative in Windows OS)

People who have used Linux knows that one of the basic requirement in that operating system is to find specific strings within specific file or files, even from the output of a particular command. In Linux to find a specific string from inside a file, multiple files or from an output of a command you use Grep as a command line option. But Grep is only limited to Linux. Not anymore because in this post we are going to tell you about the Grep alternative for windows, Findstr.

Findstr for Windows 10 – Locate Strings in Files with CLI (Grep Alternative in Windows OS)

Findstr for Windows 10 - Locate Strings in Files with CLI (Grep Alternative in Windows OS)

In this article you are going to learn How to use Findstr (Grep alternative for windows) in command prompt as well as how it’s find function works using PowerShell. The reason we are discussing this procedure is that people who uses windows are not that much use to use command line for simple things. And plenty of windows users don’t even know how to find a specific string in file by using Windows command-line and PowerShell.

Why You Should Know About Findstr?

Findstr is very easy and simple way for using command lines in windows. If you are a windows users you can get in a situation where you have to use command line. And that’s why you must have an idea of how Command line, Findstr and PowerShell works. Which is also the purpose of out this Article to provide you the basic knowledge about this.

Now let’s talk about the different situations and scenarios of the real word so you can learn the proper way and full procedure to deal with them.

By Using Command Prompt How to filter an Output of a Command

You can use | findstr “string_to_find” to filter the results of a command. Like if you want to check which app or IP address is connected to which specific port. The mostly used method is netstat, to check the connections being made on your computer. Use the following command to this

netstat | findstr “imaps”

Findstr for Windows 10 - Locate Strings in Files with CLI (Grep Alternative in Windows OS)

This will show you only the secure imap ports opened on your computer.

How to Use Command Prompt to Search for a Specific String inside a Single File

The command for this purpose is:

findstr “string_to_find” “file_name”

For example,

findstr “reader” “new 1.txt”

You can also give full path of the file if it’s not in the same directory as opened in command prompt.

Findstr for Windows 10 - Locate Strings in Files with CLI (Grep Alternative in Windows OS)

How to Use Findstr to Search for a Specific String in a Folder

If you want you can also easily specify a folder for finding a specific text string in multiple files.

findstr /M “reader” “C:\Users\ABC\Desktop\*”

This will give a list of all files with full path containing the text string “reader”. If you don’t specify /M, the output will show the exact text string along with the file name where it found the string.

Findstr for Windows 10 - Locate Strings in Files with CLI (Grep Alternative in Windows OS)

You can go through all the switches you can use with the command here.

This command can be useful in many cases especially when you are creating a log of network activities and have to find a specific thing from the log. That’s how this command-line can be used for not only one but many different purposes.

Leave a Reply

Your email address will not be published. Required fields are marked *

GetPCApps.com © 2018 - 2019 - All Software Available for Download at Get PC Apps are either Freeware or Trial Versions. We Respect Copyrights!
Close