Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedMaybe 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.
Comment #2
greg.1.anderson CreditAttribution: greg.1.anderson commentedSure, 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.
Comment #3
greg.1.anderson CreditAttribution: greg.1.anderson commentedCommitted with slight modifications. Thanks.
Comment #4
ao2 CreditAttribution: ao2 commentedWow, 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
Comment #5
moshe weitzman CreditAttribution: moshe weitzman commentedThe 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.
Comment #6
ao2 CreditAttribution: ao2 commented@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
Comment #7
greg.1.anderson CreditAttribution: greg.1.anderson commented@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.
Comment #8
ao2 CreditAttribution: ao2 commented@greg.1.anderson: no adjustments needed, and thanks again for getting dgrep in.
See you on other issues,
Antonio