Use Grep Utility to Collect Full Lines on Which Search Terms Appear
The Tip of the Night for August 4, 2018, discussed how to run Regex searches for multiple strings, collecting the complete line on which they appear. The tip showed how to do this using the grep utility, PowerGrep. Here's a slightly different approach using a list of separate search terms not written in the regular expression syntax.
1. In PowerGrep, select the folder which contains the files you want to search through in the directory tree at the left.
2. Set the action type to 'Collect Data'.
3. Set file sectioning to 'line by line'.
4. Check off the box for 'Collect/replace whole sections'
5. Set the search type to 'List of literal text'
6. Enter a string to search for in the search box, and then press the green plus icon to add additional lines.
7. For each search term, in the collect box enter: \0 to get the terms searched for (all with the complete line). You can also add %PATH% %FILENAME% to collect the file path and file names of the files you are searching.
8. Set target file creation to 'Save results into a single file' and in Target file location, enter a .csv file in which to export the search results.
![](https://static.wixstatic.com/media/af7fa4_5c63038cd8a54697b2c225b2026a5094~mv2.png/v1/fill/w_980,h_504,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/af7fa4_5c63038cd8a54697b2c225b2026a5094~mv2.png)
9. Click Collect, and as you can see PowerGrep will collect the full line on which each search term appears.
![](https://static.wixstatic.com/media/af7fa4_7b3330ffb42c45b198a2db910ed26eff~mv2.png/v1/fill/w_980,h_462,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/af7fa4_7b3330ffb42c45b198a2db910ed26eff~mv2.png)