When you preview or execute an action (but not when you use Quick Execute), PowerGREP displays the search matches it found on the Results panel. To make it easier to distinguish between all the search matches the Results panel has options to display search matches along with their context rather than just the search matches themselves. This option only works if you use asked PowerGREP to collect additional context around each search match while executing the action.
The “list files” and “merge files” action types do not allow context to be collected, because these two action types never display any search matches on the Results panel. They list file names only. The “rename files or folders” action types always collects the file’s full path as context. So for these three action types the “context” part of the Action panel is invisible.
The “simple search”, “search”, and “collect data” action types all allow context to be collected, unless you’ve turned on the option to group identical matches. When grouping identical matches each unique search match is stored only once, regardless of how often it occurs in the file(s) you’re searching through. Since identical matches may have different context, there’s no way for PowerGREP to collect that context when grouping identical matches.
The default is “no context”. This is the fastest option because PowerGREP doesn’t have to spend time locating the context or any memory storing it. The Results panel won’t show any context.
Note that you don’t need to select “no context” when using Quick Execute. Since that command tells PowerGREP not to display any search matches on the Results panel, it also disables context automatically, regardless of which context options you selected on the Action panel.
The “simple search” action type offers only two context options. Instead of the “context type” drop-down list you get a “use lines as context” checkbox. Ticking the checkbox is the same as selecting “use lines as context” in the “context type” drop-down list and turning on “show line numbers”. Clearing the checkbox is the same as selecting “no context”.
Number of extra blocks or lines of context you want before the match.
If expand to whole lines is checked, extra lines of context are added. Otherwise, extra blocks according to the context type are added.
Number of extra blocks or lines of context you want after the match.
If expand to whole lines is checked, extra lines of context are added. Otherwise, extra blocks according to the context type are added.
All the other action types that support context provide additional context types. Select “use lines as context” to get the same context options as for simple searches, plus one more:
Turn on to scan the file for lines and show line numbers with each line of context or with each match. Turn off to show sequential context numbers.
Even more context options are available if you choose another context type.
When displaying search matches on the Results panel, PowerGREP can display extra context around each search match. This context is the text that appears in the file immediately before and after the search match. This setting determines how much context PowerGREP will collect from the file, if any.
Context is only used on the Results panel. It is never saved to target files.
Collecting context slows down the search and takes up extra memory, but makes it easier to inspect the search matches on the Results panel. If you don't collect context, you need to double-click on a search match in the results to open the file it was found in on the Editor panel in order to see its context.
Turn on to count all context blocks in the file, including context that doesn't appear in the results. Turn off to show sequential context numbers in the results, ignoring any unused context.
Turn on to expand the context so that all matches are always shown with full lines of context. This makes it easier to interpret the results if you're used to working with the files with a line-based application such as a plain text editor. Turn off to allow the context to be a partial line.