The basic way to use PowerGREP's search and replace functionality is like the search and replace feature offered by any text editor. Type in the text you want to have replaced in the search box. Put the text you want to have it replaced with in the Replace box. Specify the folder and file mask (such as *.txt), and click the Execute button. PowerGREP will then perform the search and replace operation on all files matching the file mask in the folder that you specified, and in its subfolders if you want.
But PowerGREP offers you much more than that. If you want, PowerGREP will present you with a list of all replacements that have been made. Double-click on a replacement to see its context. Prevent mistakes by previewing the results before modifying any files. Replace or revert individual matches in PowerGREP's full-featured file editor. Should you change your mind later, the Undo History will save your day by restoring all files that were modified.
Specify target options to tell PowerGREP to duplicate the files searched through and make the replacements in the duplicated files. This way you can easily produce different editions of the same set of files.
Powerful Text File Maintenance with Regular Expressions
While searching and replacing pieces of text is useful, you can automate many tedious editing tasks by adding regular expressions to the mix. Let me present you with an example. Suppose you have a rather long list of pairs in the form of one=another and you want to swap them. You can do this easily with PowerGREP by searching with the regular expression (\w+)=(\w+) and replacing with \2=\1. The regular expression will match a word, followed by an equals sign, followed by another word. The parenthesis capture the first word into the first "backreference", and the second word into the second "backreference". In the replacement text, we can reuse those with \1 and \2 respectively. So setting the replacement text to \2=\1 will swap the words.
Do not worry if the above looks complex. The documentation that is included with PowerGREP contains a detailed introduction to regular expressions. With a bit of practice, you can create simple regular expressions like the above in a matter of minutes. And when you spend time creating a complex regular expression, you can save it into a PowerGREP action file or library for instant reuse later.
Unlimited Power and Flexibility
While many Windows grep tools can search and replace with a single regular expression, PowerGREP offers unparalleled power and flexibility. Apply many changes at once by using a list of regular expressions. You can have the list processed sequentially, where each step works on the results of all previous steps, or concurrently, where each step is independent. There's no limit to the number of regular expressions you can use.
You can easily perform complex editing and conversion tasks with PowerGREP's unique file sectioning and extra processing features. Instead of creating one complex regular expression that does it all, use several simple regular expressions that work together. Use file sectioning to process only certain parts of each file, such as only headings, only body text, only markup tags, only comments and strings in source code, etc. Use extra processing to modify each search match in any way you want using full regular expressions, not just simply move text around with backreferences.
|Search and replace automatically or interactively|
"I am working with my version of PowerGREP for some time now, and I really enjoy every single time where I am much faster doing complicated search&replace sessions on different files. Some people really can’t believe until they see what PowerGREP is capable of. Thanks for creating it."
— Andreas Kroll
23 July 2008, Germany
"PowerGREP is quite simply the best search and replace tool I have ever tried. Hands Down. No Contest."
— Lorne Guse
21 December 2004, Canada