PowerGREP: Taking grep Beyond The Command Line

While all of PowerGREP's functionality is also available from the command line, the key benefit of PowerGREP over the traditional grep is its flexible and convenient graphical interface. Instead of just listing the matching lines, PowerGREP will also highlight the actual matches and make them clickable. When you click on a match, PowerGREP will load the file, with syntax coloring, allowing you to easily inspect the context of a match.

PowerGREP also provides a full-featured multi-line text editor box for composing the regular expression you want to use in your search.

PowerGREP's regex flavor is a perfect blend of the Perl 5, PCRE2, Java and .NET regex flavors. If you're already familiar with one of these regex flavors, you'll be immediately at home with PowerGREP. PowerGREP's flavor is indicated as "JGsoft V2" in the tutorial and reference on this website are available in PowerGREP.

Searching Using Regular Expressions with PowerGREP

The Ultimate Search and Replace

If you already have some experience with regular expressions, then you already know that searching and replacing with regular expressions and backreferences is a powerful way to maintain all sorts of text files. If not, I suggest you download a copy of PowerGREP and take a look at the examples in the help file.

One of the benefits of using PowerGREP for such tasks, is that you can preview the replacements, and inspect the context of the replacements, just like with the search function described above. Replace or revert all matches or all matches in a file after previewing or executing the search-and-replace. Replace or revert individual or selected matches in PowerGREP's full-featured file editor. Naturally, an undo feature is available as well.

Another benefit is PowerGREP's ability to work with lists of regular expressions. You can specify as many search and replace operations as you want, to be executed together, one after the other, on the same files. Saving lists that you use regularly into a PowerGREP action file will save you a lot of time.

Collecting Information and Statistics

PowerGREP's "collect" feature is a unique and useful variation on the traditional regular expression search. Instead of outputting the line on which a match was found, it will output the regex match itself, or a variation of it. This variation is a piece of text you can compose using backreferences, just like the replacement text for a search and replace. You can have the collected matches sorted, and have identical matches grouped together. This way you can compute simple statistics. The "collect" feature is most useful if you want to extract information from log files for which no specialized analysis software exists.

Rename, Copy, Merge and Split Files

PowerGREP can do much more with regular expressions than the traditional search and search-and-replace jobs. Rename or copy files or entire folders by searching and replacing within their file names, folder names, or full paths. You can even compress and decompress files this way by adding or removing a .gz or .bzip2 extension, or by changing the path to be inside a .zip or .7z archive, or not. Merge or split the contents of files into new files by searching with a regular expression and using the replacement text to build a path for the target file or files.

File Filtering, File Sectioning, Extra Processing, and Context

Most grep tools can work with only one regular expression at a time. With PowerGREP, you can use up to five lists of any number of regular expressions. One list is the main search, search-and-replace, collect, rename, merge, or split action. The other lists are used for file filtering, file sectioning, extra processing, and context. Use file filtering to skip certain files based on a regex match or lack thereof. Use file sectioning to limit the main action to only certain parts of each file. Use extra processing to apply an extra search-and-replace to each individual search match. Use regexes to match blocks of context to display the results more clearly if your files aren't line-based.

If this sounds complicated, it isn't. You can often use far simpler regular expressions with PowerGREP. Instead of creating a complicated regex to match an email address inside an HTML anchor tag, use a standard regex matching an email address as the search action, and a standard regex matching an HTML anchor tag for file sectioning.

More Information on PowerGREP and Free Trial Download

PowerGREP works under Windows XP, Vista, 7, 8, 8.1, and 10. For more information on PowerGREP, please visit www.powergrep.com.

Make a Donation

Did this website just save you a trip to the bookstore? Please make a donation to support this site, and you'll get a lifetime of advertisement-free access to this site!

Quick Start | Tutorial | Tools & Languages | Examples | Reference | Book Reviews |

grep | PowerGREP | RegexBuddy | RegexMagic |

EditPad Lite | EditPad Pro |

Boost | Delphi | GNU (Linux) | Groovy | Java | JavaScript | .NET | PCRE (C/C++) | PCRE2 (C/C++) | Perl | PHP | POSIX | PowerShell | Python | R | Ruby | std::regex | Tcl | VBScript | Visual Basic 6 | wxWidgets | XML Schema | Xojo | XQuery & XPath | XRegExp |

MySQL | Oracle | PostgreSQL |