top of page

Regex search for multiple strings, collecting complete line on which they appear


Here's a demonstration of a RegEx search run in the grep utility, Power Grep, that will collect the complete line of text that any one of multiple search terms appears on.

In this regex search the strings are separated with pipes "|" and strings of multiple words are enclosed with quotes.

^.*\b("Information Governance".*|Identification.*|Preservation|Collection.*)\b.*$

In PowerGrep set the Action Type to 'Collect Data'. Do not filter files and do not section files. The search type should be set to 'Regular Expression'.

In the Collect box enter '\0' to get the results of the search then %FILENAME% (preceded by a delimiter like a ~) so the names of the source files are included in the collected text.

Be sure to have line breaks between collected text, and save the results to a single file. Make it a .csv file.

The resulting file can be separated into two columns in Excel, and you'll be able to easily parse out the data.


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

​

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

​

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page