top of page

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.


 
 

If you want to get a list of files inside a zip file, you can use a Windows command to do so. This is an alternative to the technique that I blogged about March 18, 2016 that involving installing an add-in for WinZip. That add-in hasn't been so reliable for me and I like this method better.

In this example we see a folder containing two different types of container files in the format for WinZip ('helloworld3.zip') and 7-zip (FooFolder.7z). Before beginning, confirm that you have 7-zip installed as this script will utilize that software.

1. Locate the folder containing the 7-zip software files, which will probably be at: C:\Program Files\7-Zip . Copy the files named, '7z.dll'; '7z.exe'; and '7z.sfx', and paste them into the folder containing your container files.

2. Next we're going to create a text file in this folder and enter this script:

FOR /F "tokens=* delims=" %%A in ('dir /b /s *.zip') do (7z.exe l -r "%%A" >> listing.txt)

3. Save the text file and change its extension to '.bat'. Double-click on the file and a new text file will be generated listing the files in the zip file.

If you change the reference to 'dir /b /s *.zip' to 'dir /b /s *.7z' this will work on archive files in the native 7-zip format as well.


 
 

There are different operators that you can use with the Windows XCOPY command, which was discussed in this Tip of the Night. See the list on the Windows site here. So for example if you enter this command in a .bat file:

xcopy C:\MyData E:\NewFolder /y /e /s

. . . the operator /y will copy data without prompting the user to answer yes or no as to whether or not she wants to overwrite files. /s copies data from directories and subdirectories. Adding '/e' will copy the subdirectories even if they are empty.


 
 

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