What is an utility to find code throughout many files or folders. Something akin to PowerGrep but freeware.
views:
331answers:
15If it's on a Mac, TextWrangler is rather fantastic for multi-file search with grep.
On Windows, there's a "find" command that is similar to grep.
You could also download cygwin or some other Unix emulator and get grep from that.
On Windows, you can also get a standalone version of grep with "unxutils" pack: http://unxutils.sourceforge.net/
You could also try Komodo Edit. It's a development IDE that supports many languages and has support for recursively searching directories. It's written in Java so it works on "every" platform.
Since it seems that you're on Windows, Google tells me you can actually use the DOS cmd line:
Recursive Find Text String In Files, Output Line Number:
FOR /R c:\~kenneth %v IN (*.css) DO find /N /I "#banner" "%~fv" >> test.txt
Note the %v is a variable, could be any letter. The quoted "%~fv" expands to the quoted fully qualified pathname. With out quotes Directories with spaces are not processed.
*.css could be any wildcard or even * for all. the >> concatenates the output to one file, in this case test.txt.
Find more examples here: http://kennethhunt.com/archives/000173.html
I have not seen PowerGrep but Visual Studio's "Find in files" works best for me. Also allows "Replace in files" and opens changed files to enable undo.
On recent versions of Windows you'll be well served with findstr.exe which has more features than find.exe.
findstr /nips /c:"unique text string" *.txt
It's not as powerful as grep but it works. The /n gives you line numbers, /m will just give you filenames.
If you forget the file spec it will just wait around for termination.
I'd also recommend learning cmd shell scripting. Start with "for /?".
I use Notepad++ for this. It even has regex support.
Search->Search in files
For Windows I've used Agent Ransack before in the past and it's done a pretty good job.
Eclipse is powerful and is free. Ctrl + Alt + H will search for methods, declarations, types or just free text in any language Eclipse supports. You can even use wildcards and regex.
I've been struggling with finding all the access to some method, for example. Once again, Eclipse does it for me very well: Ctrl + H will open the Call Hierarchy view.
I know you're asking for freeware, but in case anyone else is browsing this question, I'd recommend a look at Eluent Find. I bought this years ago, and use it daily. I have lots of path plans and extension configs set up for different types of searches I do.
It's aging a bit, doesn't seem to be getting upgraded, but it works as advertised, not sure what they'd add to it. Every year or so I look around around to check the competition, and haven't found anything that works better for me. The path plans are the key feature.
$20.
If you install cygwin, you get the find
and grep
utilities, which can be used in concert like so:
find <dir> -name '*.cpp' -exec grep -H <pattern> {} \;
Or simply recursive grep, if you don't care about filtering by file-extension:
grep -R <pattern> <dir>
Google Desktop. Once it's indexed your files, it's very fast for searching for and within all your files - code or otherwise. You can also search by file type.
If you're using Windows XP, I wouldn't recommend Windows Live Search; it's slow and clunky.
Another vote for ack. It's usefulness can not be overstated, it truly is your best friend when dealing with a large code base.