The “search”, “collect data”, and “merge files” action types save search matches to one or more target files, at least when “target file creation” is set to anything except “do not save results to file”. If an action finds three matches 1, 2, and 3 you may want to save them as 1,2,3 into the target file rather than as 123. The “collect between” part of the Action panel is where you can tell PowerGREP what, if anything, PowerGREP should place between the collected matches. In this example we’re putting a comma between all the matches.
In addition or instead of putting text between matches, you can add a header and footer to each target file created by PowerGREP. When collecting matches from multiple source files (files that were searched through) into a single target file, you can also add a header and footer to the blocks of matches that were found in the same source file. You can use path placeholders to add references to the files the matches were found in.
The appearance of the “collect between” part of the action changes based on what you select in the “between collected text” drop-down list and whether you tick “collect headers and footers”. If you’re not using any options that require custom text, no text box appears:
If you’re using only one delimiter between the matches without any headers or footers, you get one box to type in that delimiter:
If you’re using multiple delimiters or headers and footers then a list with different items appears. All the items in the list are used when you execute the action. The item that you select is the one that you can edit in the text box:
Choose which text, if any, you want to place between text that was collected for different search matches:
Add a header and footer to the files into which the collected text is saved. When collecting into a single file, you can also add a header and footer to the block of text collected from each file searched through.
Expand path placeholders as well as action-related and file-related match placeholders in file headers and footers. In source file headers and footers, path placeholders represent the path to the file that the matches were found in. In target file headers and footers, they represent the file that the collected text is written to.
The match placeholder %MATCHCOUNT% can be used in source file footers to indicate the number of matches found in each source file. %MATCHCOUNT% can be used in target file footers to indicate the number of matches written to each target file. %FILECOUNT% can be used in target file footers to indicate the number of source files that had their matches written to that target file.
Select the text you want to edit in the edit box to the right of this list. Which matches are available depends on the choices you make for "between collected text", "collect headers and footers", and "target file creation".
Examples: Compile indices of files and Generate a PHP navigation bar