Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Search DOS files for text-list file
Name: philiplawlor Date: March 4, 2009 at 14:16:21 Pacific OS: Windows Server 2003 - DOS Subcategory: Batch
Comment:
I need to search a directory of 75000 text files for any files containing a particular string. How can I search the files for the string and output a list of those files into a text file?
I am currently doing this: find /C "SEARCHSTRING" *.txt > c:\Wanted.txt
however the output file is filled with non-hits as well as hits. -------File1.txt: 0 -------File2.txt: 2 -------File3.txt: 0
in this case I only want to trap File2.txt in my output log.
Name: philiplawlor Date: March 5, 2009 at 12:20:47 Pacific
Reply:
Excellent! It created blank lines in the Wanted.txt, but i pasted that in excel and sorted! Blanks drop to the bottom and good stuff to the top.
So for learning purposes the first "find /c" located any instance of the search string in the selected text file and outputted a count of the instance starting at zero. The Pipe sent that output to the next "find /v" which omits any " 0" or count of zero. That output is then written to the c:\Wanted.txt file.
Summary: I have a text list of about 3000 numbers/names that correspond (only partially) to file names in a folder/subfolders that need to be compiled into one new folder (files only; not directory structure)....
Summary: Sorry, I'll try to be clearer this time around. The input is a text file with many lines (thousands, in some cases, if not tens of thousands) each describing some element of a complex file, which can ...
Summary: I have about 150 files moved to a specific folder on a nightly basis. From here, these files get loaded into the database. The file extension uses a date and time stamp. A series of files will look si...