I am working on legacy projects with thousands of files spanning more than 10 projects. I am wondering what other people are using for searching string in a text file.

I am using windows and i typically search on 10,000 files to make sure some code is not called from other places. I've tried numerous text search tools mentioned here such as Actual Search & Replace, Ultraedit, notepad++ but they all take very long time to search due to the large # of files they have to look into.

Please don't just post links to tools - it would be nice to know what features each suggested tool has, and why you like it!

link|improve this question
feedback

migrated from stackoverflow.com Feb 5 '11 at 1:04

This question came from our site for professional and enthusiast programmers.

11 Answers

I use http://www.wingrep.com/index.htm Windows Grep its quite powerful and quick.

link|improve this answer
feedback

I have been using PhiSearch.

link|improve this answer
Could you perhaps elaborate a bit on your answer telling us why PhiSearch is a good tool? What features does it have? Is it free? Why do you like it? – nhinkle Feb 5 '11 at 21:36
feedback

It's usually grep, which was already mentioned. ack is worth to be mentioned too.

link|improve this answer
feedback

Almost every *nix user knows about standard grep utility and extensively uses it for tasks you describe.

link|improve this answer
feedback

Windows has findstr built in. It is kinda like grep in linux.

link|improve this answer
feedback

FileSeek works for me. It's fast and easy to use, and integrates with the Windows shell. It can search for strings in any kind of file, not just text files. It supports regular expression search strings. Other features and options include case-sensitivity, showing all matches or only the first match in each file, combinations of file patterns and search strings, file exclusions, all/any matches and so on. Freeware.

link|improve this answer
feedback

I'm using copernic when I need to search c++ libraries. I think it's search gui is among the best. However it needs some tweaking, like adding file types to index and ensuring that immediate indexing isn't enabled (because it tends to lock files from the editor sometimes).

link|improve this answer
feedback

I use RefactorBuddy, a tool I wrote specifically for find/replace across files. It's written in Java, but it's free but closed source (and I am actively developing it as time permits). The pattern matching engine is different from RegEx and there's a little bit of help to explain the patterns (full help is still pending finishing some more road-map features I want in there before 1.0).

One thing that might be a problem for C++ source is that it assumes and writes (on replace) UTF-8. I do plan to make the encoding selectable in future, but that's not a priority for me because all my source is pure ASCII or UTF-8.

link|improve this answer
feedback

I'd recommend looking into ctags(1) from *nix, which is specifically designed for just what you've described: cross-referencing within source code. There's a version of ctags available as part of the vim text-editor package, but there are also numerous variants, such as within the Cygwin package as well.

The basic idea is that you kick off big "crunch" job that indexes all the files in each project, and when that's complete, you can near-instantly jump to any definition or reference of a symbol (such as a method/function/subroutine name).

Depending on your usage patterns, and the rate at which the target projects are being updated, this could be a major win for you.

link|improve this answer
feedback

I do all of my text searching in TextPad. It's pretty quick, and I can't live without it's support for POSIX regular expressions. However, most things are going to choke on 10000 files.

If most of the code is truly legacy and remains unaltered, what about scraping the source for all of the function names into a single text file and then searching just that? You could periodically re-search the 10000 files to keep it up-to-date.

I'd use TextPad for this as each instance it finds is listed on a new line in the search results. Double-clicking on the relevant line opens up the relevant file where the instance resides. TextPad can save the search results in what it calls a Workspace so you wouldn't have to redo the search each time you opened TextPad (unless you wanted to).

Here's what the search results look like:

sqlite.cpp(80): int SQLiteSTMT::Bind(int iCol, sqlite3_int64 value) {
sqlite.cpp(84): int SQLiteSTMT::Bind(int iCol) {
sqlite.cpp(88): int SQLiteSTMT::Bind(int iCol, const char* value, int len, void destructor(void*)) {
sqlite.cpp(92): int SQLiteSTMT::Bind(int iCol, const sqlite3_value* value) {
sqlite.cpp(96): int SQLiteSTMT::BindBlob(int iCol, const void* value, int len, void destructor(void*)) {
link|improve this answer
feedback

I'm using FileSearchEX. I don't know if it is flat out the best for your problem, but it has worked well for me.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown