Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command line search

Status
Not open for further replies.

rrsub

MIS
Joined
Oct 23, 2002
Messages
536
Location
US
Is there a command line search utility for W2K?
Looking for a string inside text files in a directory. The directory has 1,000,000 + files.
I would like to parse to a text file.
 
Press Windows F to open find

In "Search for files or folders named" put the path and extension to search within.
eg

C:\Data\*.txt

In the "Containing text" box put what you want to locate

eg
"My Info"

then click search.

John


 
This won't parse the results for you, but you can use the standard Start -> Search -> For Files or Folders and specify your string in the Containing text field. Would that work for your purposes?

If you really need something output to a txt file I'm sure we can dig something up.

<?legalstuff
The above is my opinion only and should not be construed as the opinion of my employer.
?>
 
Following from my post...

You can either use the Generic/Text only printer pointing to File to print it to a text file, or try:

Ctrl A to select all results
Ctrl C to copy
Paste to notepad and save

John
 

Open command prompt and get to the directory you want to search from and type:

findstr /i textyouwanttofindhere *.txt > results.txt

For more information on wildcarding and different ways of searching, at the command prompt type:

findstr /?

There are a lot of variations to the command depending on what and how you want to search, just use the /? option and read what all you can and cannot search for.

Once you have the command line syntax the way you want, just remember to include the > results.txt at the end of the line and that will redirect the results of your search to that file instead of the prompt window.

The results file will contain the filename and the string that matched your search criteria.

Good luck!

 
Windows includes a command called FINDSTR. Type findstr /? at a command prompt to get the command line options. Even the standard FIND command will search for a text string within a file but FINDSTR has extra options.
 
FINDSTR was what I was looking for. THANKS!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top