PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Nov 13, 2018 12:47 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Noob Question about grep
PostPosted: Mon Apr 18, 2011 3:29 am 
Offline
Forum Commoner

Joined: Thu Mar 10, 2011 2:03 pm
Posts: 32
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:

Syntax: [ Download ] [ Hide ]
grep -ir --include=*.php 'buildorderconfirmation' *


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


Top
 Profile  
 
PostPosted: Mon Apr 18, 2011 4:47 pm 
Offline
DevNet Resident
User avatar

Joined: Thu May 14, 2009 3:00 pm
Posts: 1011
Location: HellCity, Bulgaria
you can try:
Code:
find -regex .*\.php | grep -Roni 'buildorderconfirmation'

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)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group