Hi,

I wrote a new “grep” command to search raw content in Drupal using regular expressions; you can find it in my git repository for now: http://git.ao2.it/dgrep.git/

Here is also an article about it with an example run: http://ao2.it/blog/2010/10/16/drush-grep-search-raw-content-drupal-regul...

Maybe after some discussion and some work this functionality can become part of drush core?
Comments, critics and patches welcomed.

Regards,
Antonio

Comments

moshe weitzman’s picture

Project: Drush » Drush extras
Version: » 7.x-1.x-dev

Maybe another option should let users grep through cck fields or core Fields in D7? In any case, this is drush_extras material IMO. Greg will decide whether this gets committed there.

This will take forever and consume loads of memory on sites with lots of nodes or comments.

greg.1.anderson’s picture

Status: Needs work » Needs review

Sure, I'll take this in drush extras. First I need to find time to recreate drush extras, then I'll review the code. In the meantime, feel free to continue to post enhancements.

greg.1.anderson’s picture

Category: task » feature
Status: Needs review » Fixed

Committed with slight modifications. Thanks.

ao2’s picture

Wow, that was fast.

@greg.1.anderson: how do I update the command from now on? I can of course send patches, but with CVS I won't be credited for them in the project history. With git that would be a non-issue as it records the author of a change along with the committer.

The alternative would be to apply for commit access, what do you think about that?

The changes I have in mind are about using pcre_grep for the 'drush grep' command, producing an output similar to GNU grep, and maybe add other commands like 'drush match', 'drush match_all' using the relative php preg_* functions.

Thanks,
Antonio

moshe weitzman’s picture

The way credit is given is in the commit message. These messages have a convention that is easily parseable and thats what Certified to Rock does, among others. As you say, the git migration will improve this.

ao2’s picture

@moshe weitzman: I see, just make sure the convention is respected and that every commit has its own topic; look at http://drupal.org/cvs?commit=438794 for instance, I would have expected dgrep.drush.inc to be committed alone with reference to me and this issue, but I understand that CVS encourages these bulk-commit practice, so not it's not all developer's fault and I am not going to make it a big deal.

I am OK with patches then, there's no need I apply for CVS commit right now.

I didn't know Certified to Rock, thanks for pointing it out.

Regards,
Antonio

greg.1.anderson’s picture

@a02: Regarding the commit you reference above, I did a bulk-commit because I was (finally) recreating the entire drush_extras project, so I lazily did it with a single commit. Usually (henceforth) I will use a single commit for a single change, and credit the author as moshe describes above. See the commit history / release notes for drush as an example. Let me know if you would like me to make any adjustments to the committed code to clarify the issue of credit; I'd be happy to do so.

Your future changes sound good. Please put future enhancements in drush_extras in separate issues. If you make frequent contributions across multiple commands, I'd certainly consider adding you as a co-maintainer.

ao2’s picture

@greg.1.anderson: no adjustments needed, and thanks again for getting dgrep in.

See you on other issues,
Antonio

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.