- Node management script
- Easy recipe for posting events with signups on your website
- Handling PDO:_construct error on XAMPP
- Merit badges and counselors for Boy Scout site
- Easy Recipe for a photo gallery with a slideshow block
- How much should a website cost?
- From "Brochureware" to "Communityware"
- rgrep
- Limiting number of characters allowed in a profile field
- Why build websites using Drupal?
rgrep
Here's a very helpful recursive grep commandline script I use on OSX and Linux all the time.
To use, just cd to the starting directory and type rgrep string. This will find all occurrences of "string" in the starting directory and any of its subdirectories.
Copy the code below and write it to a file called 'rgrep'. Make sure rgrep is somewhere in your path. (Maybe under ~/bin.)
#!/usr/bin/perl
$| = 1;
my ($str) = @ARGV;
if (!$str) {
die "Syntax: $0 {str} # finds {str} starting in current dir.\n";
}
my $cmd = "find . -exec grep -H -n '$str' {} \\;";
open(CMD,"$cmd|") or die "Unable to open CMD: $!\n";
while(<CMD>) {
print $_;
}
As you can see, this command depends on the system's find and grep commands.
Post a comment to let me know what you think!
