开发者

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

How do i find out which script is inserting into mysql db wit开发者_StackOverflow中文版hout viewing a million files?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜