| Category: | development tool |
| Author/Contact Info | Artem Litvinovichartem@hoflink.com |
| Description: | Finds specified substrings in documents under a specified directory. Usefull for tracking down obscure variables and methods/functions/subs in source packages. |
#!/usr/bin/perl
# findstr by Artem Litivnovich
# November 1, 2001
# recursively searches for specified string within specified directory
# usage: findstr <directory> <string>
use File::Find;
my ($sep,$recdepth) = ('/', 3);
print "looking in $ARGV[0] for $ARGV[1]\n";
find(\&wanted, $ARGV[0]);
sub wanted {
undef $/;
open FILE, "<$_";
my $text = <FILE>;
print "Found $ARGV[1] in $File::Find::name\n" if($text =~ /$ARGV[1
+]/);
close(FILE);
}
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: findstr
by gmax (Abbot) on Dec 28, 2001 at 13:31 UTC | |
|
Re: findstr
by dmitri (Priest) on Jan 04, 2002 at 09:54 UTC |