Something that you might find quite annoying when you have several text files which might have a certain name or text string that you want to search for is having to look through each one to try and find what you want. Obviously this just isn’t efficient especially when there are hundreds or more files to look through. It becomes even more frustrating when you want to search lots of files for keywords or phrases and replace them with something else because a tool like Notepad just doesn’t work for anything but the most basic of tasks.
There are several more advanced text editors around that could have some form of function to search and replace text strings, but if you don’t want to use the editor itself, this may seem bit pointless. Thankfully there are tools around dedicated to performing the search and replace function and many are portable meaning if you only want to do it once or twice, there’s no need to install anything. Here’s a selection of 5 search and replace tools with varying functionality for you to look at.
1. Find and Replace (FAR)
The Find and Replace tool has options to simply search for strings inside files, replace the strings inside the matching files and also to find and replace text inside file names. FAR is a cross platform and portable tool because it’s built on Java but that also makes it quite heavy on memory usage. And of course, you’ll need the Java Runtime Environment installed to use it.
Just about all boxes where you need to enter text will accept regular expressions, go to Help -> Regex for more help on how to use them. Both the replace and rename functions require you to run the find function first and you simply need to supply a folder, a file name pattern and the optional content to search for, or reverse it using the Exclude tick box. The program also has a few basic selection filters, some copy, move and delete file operations and options to trim or remove blanks lines from the files while also being able to change the encoding of the files between Windows-1252/UTF-8/US-ASCII.
For normal usage WildReplace is an easy to use tool that can perform a simple search for a given string and show the results in an Explorer like color coded structured folder tree. Tick the “Replace with” box and enter a string to start a find and replace operation.
There are some very useful functions tucked away such as some simple file operations where you can copy or move the files with the matching string to a specified folder or even delete them permanently. Advanced Options will allow the filtering of files by size, file attributes and date. The most powerful feature is the regular expressions input where you can enter your own arguments or click the RegEx Help button to get a window full of sequences, classes and separators that can be used. It also includes a very handy Expression Tester to try out various RegEx sequences. WildReplace is also portable.
If you want a quick and easy search and replace tool then TurboSR could be handy because it has no real advanced functions but simply concentrates on replacing one text string with another in all the chosen files in a specified folder.
The program is a completely portable standalone executable but be aware it creates a shortcut to itself in Accessories in the Start menu. Usage is simply a case of selecting a text based extension to search for such as .txt, .log or .html etc (there are around 15), locate the folder you want to search in and tick the sub folder option if needed, enter the “Search for” and “Replace with” strings and then click the Go button. If matches are found, TurboSR will popup a window where you can skip the replace, replace the chosen text or replace all matches from now on.
4. Replace Text
Replace Text used to be called BK ReplaceEm and was quite a popular tool for searching and replacing operations. Although the Replace Text Tool itself is no longer supported and developed, it’s still quite useful and also easy to use even for replacing several phrases across multiple text files. Being a portable tool is also a useful advantage.
The program works by using Groups which you add the individual files or complete folders to, and then setup all the search and replace text for that group. This is quite useful because you can have several sets of files and locations each with their own set of replacement strings. Simply add the files/folders to a group, click on the group and enter all the original and replacement text. Backups can be configured and are enabled by default with the .backup extension. Right click on the text to go to Advanced Edit where you can change the search between case, exact, range and regular expression, and can choose to replace the text or insert it before or after the search string.
TextCrawler is without doubt a very feature rich utility and has a number advanced functions built in. Taking into account all the extra options on offer, the program is still relatively easy to operate and can be used for more standard search and replace operations on a single file or whole folder without too much trouble.
In addition to the 7 preset file extensions, you can also supply your own filter and add an exclusion filter as well. There’s a standard mode where you can replace, insert before/after, delete or clear the matched string and a regular expression mode to enter more advanced search and replace functions. Custom regular expressions can be saved using the library function and there’s also an expression tester where you can try them out before applying to the files. Some other valuable functions are Fuzzy Search which will find near matches to the search text, a batch editor which allows multiple replace options on the same files and a text extractor where you can rip the text into a new file. Backups can be enabled in the Options.
Editor’s Note: If you use a third party text editor such as Notepad++, it’s also worth checking to see if it has some form of search and replace in multiple files function. For instance, in Notepad++ you can go to Search -> “Find in Files…” and do a search and replace of a directory contents.