Have you ever had to find some text in a bunch of different text files? If you work in IT, this problem can occur quite often. Perhaps you are looking for a specific phrase in the log files, or perhaps you are a programmer and need to find code that is found in many different code files.
Unfortunately, there is no easy way to do this on Windows. Windows Standard Search is terrible for this kind of task because it is very slow and does not allow advanced searches. Fortunately, there are several other ways that go far beyond Windows search, which I will cover in this post. I won’t go into details of each solution, but you can use Google to find out more.
If you don’t want to install any third-party software and are comfortable with the command line, you should check out the built-in search commands section below. I assume most people are more comfortable with GUIs, so I’ll mention programs first.
Third-party search programs
When it comes to searching multiple text files, grep is the king of all search commands. grep is a UNIX / Linux command line utility that allows you to perform advanced searches using regular expressions. It is very popular and is used in all Linux distributions.
Therefore, when someone writes a program to search Windows, the word grep is inevitably present. This is the case with all the programs listed below.
grepWin is probably the most popular of the tools mentioned here. It supports regular expressions and allows you to find and replace text. They also have a tutorial on their website to help with regular expressions, although you can use Google for many more.
You can limit your search by file size, file type, and other criteria. It also adds an option to the right-click context menu in File Explorer to quickly search a folder. The results are listed in the bottom window and you can simply double click on them to open the files.
AstroGrep is another really good search engine. Not only is it updated quite often, but it also shows where the text was found in the file. grepWin also has this option if you select the Content radio button, but I think AstroGrep has it better.
AstroGrep can also search for Word files, which is a handy feature. You can also save or print all results for future reference. I also find their interface to be more modern and pleasing to the eye.
BareGrep is a fairly simple search program that supports regular expressions and all basic search functions. This is generally quite fast and shows matches in tabular format. The free version has a splash screen that cannot be turned off. The pro version costs $ 25 and seems to just turn off the splash screen, otherwise the functions are the same.
If you’re looking for the perfect finder, look beyond PowerGREP This program has some serious features and a serious price tag. That’s a whopping $ 159! It has almost all the features mentioned above plus a few others, and they are all nicely packaged in a rather small interface.
I only recommend this program if you have serious search needs, including searching for text in Word files, PDFs, Excel spreadsheets, etc. It can even extract statistics from your log files and provide you with this information. It’s a pretty powerful tool.
Built-in Windows Commands
If you just want a quick search and don’t want to install a complete program, you can use the built-in command line tools in Windows. One runs on a regular command line and the other uses PowerShell. Both are powerful enough and can find just about anything you are looking for.
The first command is findstr. You can read the reference document here to learn how to use findstr. You can also type findstr /? on the command line and it will show you the usage. As you can see, there are quite a few options. Obviously, this is much more complicated than using one of the programs above.
The second option is the Windows PowerShell Select-String command. Again, these commands are quite time consuming if you haven’t used them yet. Microsoft has a good tutorial on using Select-String, so be sure to read it.
Thus, these are essentially the best ways to search for text in a large number of files. I suggest you try different options and see which one suits you best. Enjoy!