Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cleo

macrumors 65816
Original poster
Jan 21, 2002
1,186
0
Tampa Bay Area, FL, USA
Without going into to much detail: I'm working with a fairly complex script, and said script has some fairly complex plugins. I wrote none of them, but I know my way arond them well enough. All PHP, btw.

Anyway, a small chunk of code (an embedded stylesheet - just three lines, but three havoc-wreaking lines) is being generated somewhere along the way by one of the many parts of the script (or its plugins). I must kill this code, but I can't figure out where it's coming from.

If I were working on my local machine, I'd open up every sing file in every single directory & subdirectory and do a multi-file search with BBEdit. But it's on a remote shared server. I still could open all the files, etc etc, but opening them all would take a lot longer.

This is what I want: I want to say to a little script, "See that directory? I want you to search every file in it, and every nested file all the way down, for the following string. And when you find it, tell me where."

Unfortunately computers don't speak English. So how can I hunt down the elusive style-generator and squash it once and for all?
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
this seems like the perfect job for grep as long as you can get to the filesystem via the terminal.

the -R switch will search recursively, so you could do something like:
grep -R "some text from the style" /folder/to/start/from/*

And it should show you the full path and matching line of any files it finds that match. I don't know anything about BBedit, but once you'd found the offending file(s) it should be simple to grab their paths and edit them.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.