View Full Version : Tool to search strings in a folder full of php files?

c q
03-24-2007, 01:48 PM
I am trying to implement moodle on my intranet... but facing a lot of problems fine-tuning it to my needs... even simple things like hcanging the headings is a real head ache cuz i just cant find exactly which file is causing a particular heading to appear the way it does.

is anyone aware of any tool/software that'll help me search for a string WITHIN the php code of multiple files?

thanks in advance
- cq

03-24-2007, 02:15 PM
if it's a linux machine, then 'grep' is what you want.
To search for 'foo' in all files in a folder, you'd do (from a command-line):

grep foo *

to include subfolders as well (do the search recursively):

grep foo * -r

If you want to do the replaces in one go (will replace 'foo' with 'bar' in all php files):

find -name "*.php" -exec sed -i s/foo/bar/g {} ;

c q
03-26-2007, 09:10 AM
umm... no... windows it is:(

03-26-2007, 04:39 PM
Grep is great... for Windows try the free utility Agent Ransack (http://www.mythicsoft.com/agentransack/).