Noob Question about grep
Posted: Mon Apr 18, 2011 3:29 am
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
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