|
本帖最后由 zhu1234 于 2017-11-20 11:52 编辑
Action Part: Context
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.
Disabling Context
Context disabled
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.
Simple Context (Lines as Context)
Simple context
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".
Extra Context Before The Match
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.
Extra Context After The Match
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.
Regular Context (Lines as Context)
Lines as context
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:
Show Line Numbers
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.
All Context Types
Search for context
Even more context options are available if you choose another context type.
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.
No context: Do not collect any context. Only the search matches themselves will be shown in the results.
Use sections as context: When using file sectioning, you can use the section that the matches were found in as context. This is the way PowerGREP 3 used to work, which had no separate context settings.
Use lines as context: Scan the file for line breaks, and use line a search match was on for context. If the search match spans multiple lines, the lines it starts and ends on are both used for context.
Fixed-length records: Split the file in chunks of equal length. Use this for unstructured binary files and for files that consist of fixed-length records.
Split along delimiters: Split the file at each match of the context search term(s). The text between the main search match and the context delimiters and precede and follow the main search match is used for context.
Search for context: Use each match of the context search term(s) as a block of context. If a main search match falls entirely within a context search match, that context match is used for context. If not, the context search matches in which the main search match begins and ends are used for context. If the main and context searches do not always produce overlapping matches, some matches will be displayed without context.
Search and collect context: As above, but with the ability to specify a backreference in the context collect box to use only part of the context regex match as context. This requires the context search to be a regular expression.
Count All 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.
Expand to Whole Lines
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.
|
|