Like any Windows grep tool, with PowerGREP you can limit the search to specific files. On top of that, PowerGREP offers you the unique ability to search only through specific parts or sections of those files. E.g. when searching through HTML files, you can easily limit the search to the headings in those files.
The key benefit of PowerGREP’s file sectioning is that using it, you can keep your regular expressions or search queries simple. In the screen shot, you can see a search-and-replace to be executed on Java and C++ source code files. With PowerGREP’s file sectioning feature, the search is restricted to comments and strings in Java and C++ source code files. This is done with a list of four simple regular expressions. One for single-line comments, one for multi-line comments, one for strings, and one for characters. Achieving the same with a single regular expression in a basic grep tool is certainly possible, but far more complicated. With PowerGREP, you just need three off-the-shelf (or, off PowerGREP’s library) regular expressions that you can reuse in many situations.
Split Files into Records
When you search through entire files, PowerGREP will by default display one line of context in the results for each match. Just like most other Windows grep tools.
If your files are not line-based, use PowerGREP’s file sectioning to split the file into records or logical chunks, any way you want. The results will then display whole records as context in the search results. You can either use a regular expression to match entire records, or simply specify the record delimiters.