views:

69

answers:

1

How do i find out which script is inserting into mysql db without viewing a million files?

+3  A: 

A very general approach, if you're on Unix or Mac, is to type:

find . -name "[script pattern]" -exec grep -Hn "[search pattern]" {} \;

where script pattern is something like *.sh that matches your script and search pattern is something that will match the insertion command you're looking for.

find is a *nix program that finds all files in a directory and its subdirectories, the . is where to search from (replace it with / if you want to search your entire machine, but be prepared to wait awhile, and you might want to redirect error output to /dev/null). -exec is an option in find that runs a program on the files it finds, grep is a search engine, -Hn tells it to report the file name and line number where it finds the pattern requested, and {} \; is just syntactic sugar required by the -exec option.

Ben Hocking