top of page

findstr to search a text file for matching strings


I've posted about findstr in the past on July 5, 2016, when I explained how to use the Windows command to search for specified string, and on July 6, 2016 when I discussed how to search just the beginning or ending of text files. This night's tips shows how you can use findstr to search through one long text for a list of terms in another text file.

We write the command this way, after pressing SHIFT + CTRL right click, and choosing 'Open command window here' from the menu which appears.

findstr /X /G:bountyhunters.txt characterlist.txt >results.txt

. . . so findstr is the command; the operator /X tells it to look for lines that match exactly; /G: specifies the file containing the strings you want to look for; the text file you're searching comes next; and with > we specify an output file.

So this is the text file we search through:

. . . this file is the one with the strings we're looking for:

. . . here's the command in action:

. . . and we end up with these results.


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