Chani
Chani

Reputation: 5175

Searching for a particular string in 5000+ text files.

I solve bugs for a product. The customer has sent a bundle of log files. I am required to search for a particular string in these log files. The number of log files is more than five thousand.

I cannot use grep because I am working on a windows machine.

What are my options here ? I was thinking about writing a program in java where I open every text file in a directory and search for a particular pattern. But I could not find a api where i can open every file one after the other.

Can you please suggest me a solution. I can also code in C++ or C# is somehow a solution can be built there.

Upvotes: 1

Views: 513

Answers (6)

blackbada_cpp
blackbada_cpp

Reputation: 432

Consider VIM editor which is awesome when working with huge files. You can use it under Cygwin, and you can use on Windows. Use cheat sheets to learn it quickly.

Upvotes: 1

Pete Becker
Pete Becker

Reputation: 76523

Perl. It takes about three lines of code to search every file in a directory for a string. You can learn enough Perl to do that in half an hour.

Upvotes: 1

Roy
Roy

Reputation: 984

This works in Windows XP. I don't know about the more current versions.

Click on the Windows Start Button Click on Search A new window will open. On the bottom left, click on "Click here to use Windows Search Companion" Another window will open. In the text box labeled "A word or phrase in the file" type in what you're looking for. In the combobox labeled "Look in", at the very bottom, select "browse..." and select the folder with all the log files. Click "Search" Wait for the results...

Note: there are 2 search programs. The first one only finds things that have been indexed, which is why you should use the second search program instead.

Good luck!

Upvotes: 1

hyde
hyde

Reputation: 62906

If you need to do this only manually, then just install any decent editor (my suggestion would be http://notepad-plus-plus.org/), and use its find-in-files function.

Upvotes: 5

bibbsey
bibbsey

Reputation: 1039

How about using findstr command from command prompt.

Upvotes: 2

Minion91
Minion91

Reputation: 1929

I would suggest installing Cygwin and using grep

Upvotes: 13

Related Questions