Hey guys, I've googled this for a while, but haven't had much luck. The answer's probably really obvious, BUT...
I've just started a new job, part of which involves developing with the Interspire shopping cart, and I've found using grep really handy to search through the includes directories for function names, and references to their global variables system. Generally I want to search in httpdocs and recurse through directories looking only in PHP files, and sometimes HTML files. The problem is, there's a MASSIVE image directory (anybody who's ever used the ISC will know what I mean), and I want the search to completely ignore the images, or the directory. Here's what I've tried:
[text]grep -ir --include=*.php 'buildorderconfirmation' *[/text]
This finds what I want it to find, but it takes a long time to do it, so I suspect it's still searching the image directory, though I could be wrong. So do the 'include' and 'exclude' parameters just affect the results that are displayed, or do they actually tell it what files to look through, and which to completely ignore?
Cheers
Noob Question about grep
Moderator: General Moderators
Re: Noob Question about grep
you can try:
if it's not faster, the problem is in listing the directory contents, and not in parsing files (if there are thousand of files in single directory and you are using ext3 file system, you are in trouble)
Code: Select all
find -regex .*\.php | grep -Roni 'buildorderconfirmation'