MESSAGE
| DATE | 2002-10-02 |
| FROM | Ruben I Safir
|
| SUBJECT | Re: [hangout] Cgi Search
|
From owner-hangout-desteny-at-mrbrklyn.com Wed Oct 2 17:20:02 2002 Received: from www2.mrbrklyn.com (localhost [127.0.0.1]) by mrbrklyn.com (8.12.3/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id g92LK20c007460 for ; Wed, 2 Oct 2002 17:20:02 -0400 Received: (from mdom-at-localhost) by www2.mrbrklyn.com (8.12.3/8.12.3/Submit) id g92LK2q5007459 for hangout-desteny; Wed, 2 Oct 2002 17:20:02 -0400 X-Authentication-Warning: www2.mrbrklyn.com: mdom set sender to owner-hangout-at-www2.mrbrklyn.com using -f Received: from www2.mrbrklyn.com (localhost [127.0.0.1]) by mrbrklyn.com (8.12.3/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id g92LK20c007454; Wed, 2 Oct 2002 17:20:02 -0400 Received: (from ruben-at-localhost) by www2.mrbrklyn.com (8.12.3/8.12.3/Submit) id g92LK2C3007453; Wed, 2 Oct 2002 17:20:02 -0400 Date: Wed, 2 Oct 2002 17:20:02 -0400 From: Ruben I Safir To: joev_nylxs-at-pipeline.com Cc: NYLXS Subject: Re: [hangout] Cgi Search Message-ID: <20021002172002.A7372-at-www2.mrbrklyn.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 In-Reply-To: ; from joev_nylxs-at-pipeline.com on Wed, Oct 02, 2002 at 16:04:43 -0400 X-Mailer: Balsa 1.2.3 Sender: owner-hangout-at-mrbrklyn.com Precedence: bulk Reply-To: Ruben I Safir List: New Yorkers Linux Scene Admin: To unsubscribe send unsubscribename-at-domian.com to hangout-request-at-www2.mrbrklyn.com Content-Length: 2822 Lines: 79 Status: RO X-Status: X-Keywords: X-UID: 4513
This doesn't do what you want but it does walk the file tree.
#!/usr/bin/perl -w
my $file= '/usr/local/apache/htdocs'; ftw($file);
sub ftw{ local *SITE; #print "OPEN FTW \n\n"; my $file = shift; opendir SITE, $file or die "$! $file"; my -at-files = grep{$_ !~ /^\./}readdir(SITE); while(my $test = shift -at-files){ if( -d "$file/$test"){ # print "DIRECTORY: $file/$test\n"; ftw("$file/$test") ; next; } #print "FILE $file/$test\n"; if ($test =~ /html$/){ if(open FILE, "<$file/$test"){ open FILE2, ">$file/$test\.bak"; while(){ my $line = $_; if($line =~ /10025/){ print "$file/$test: $line"; $line =~ s/10025/10022/g; print "CHANGED: $file/$test: $line\n";
} print FILE2 "$line\n"; } } close FILE; close FILE2; } } # print "CLOSE FTW\n\n";
}
On 2002.10.02 16:04 joev_nylxs-at-pipeline.com wrote: > > I could use some help here, I need to create a search of a directory of html > files. The search would be a search for a word or phrase contianed on one in > one or more of those files. I'm thinking of opening a pipe from the perl > script to grep to do this. Is this the best way? I'm pretty sure this opens a > big security hole. > > Thanks > Joe > ____________________________ > New Yorker Free Software Users Scene > Fair Use - > because it's either fair use or useless.... > -- __________________________
Brooklyn Linux Solutions __________________________ DRM is THEFT - We are the STAKEHOLDERS http://www.nyfairuse.org
http://www.mrbrklyn.com - Consulting http://www.nylxs.com/radio - Free Software Radio Show and Archives http://www.brooklynonline.com - For the love of Brooklyn http://www.nylxs.com - Leadership Development in Free Software http://www.nyfairuse.org - The foundation of Democracy http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you... http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....
1-718-382-5752
____________________________ New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless....
|
|