the many functions of findstr part 2
top of page

the many functions of findstr part 2


Here's a follow up to last night's tip where I continue to discuss how to use findstr to collect lines with certain strings from multiple text files.

You can focus your findstr search so that it focuses only on the beginning or end of lines. We begin with one text file at the root of the source folder

. . . and these three text files in a subfolder

If we run this search with the /b qualifier to direct the search to the beginning of the line, and /s to search through subfolders:

findstr /b /s "the" *.txt >C:\Process\results5.txt

. . . we get these results, just the lines from the text files which begin with the word, 'the'.

You can also focus the search on the end of the lines and run RegEx searches:

findstr /e /r /s "[0-9][0-9][0-9][0-9]" *.txt >C:\Process\results11.txt

. . . we get these results with lines that end with four digits.

However note that if the last line of your text file contains the specific string it may not show up in the 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