Re: [pLog-General] adding PLOG_INCLUDE_PATH constant
Brought to you by:
jondaley
From: woodzy <wo...@wo...> - 2004-01-20 16:38:44
|
On Tue, 20 Jan 2004 17:43:32 +0200, Oscar Renalias <os...@re...> wrote: > > I think it sounds quite reasonable... Don't know when this feature will > show > up in CVS but I like the idea anyway, so you'll see it there sooner or > later. > Now I only need to come up with an script to replace those > include_once(...) > strings 'cause it'd be quite painful to replace 300+ files manually one > by > one...! O:) > > Reagrds, > > Oscar. > Here is a pretty script... pretty much only ... ./scriptname include_once( include_once(_VARIABLE_NAME_DEALY. .php ./scriptname <searchstring> <replacestring> <file_wildcard> #!/usr/bin/perl my $find = $ARGV[0]; my $replace = $ARGV[1]; my $glob = $ARGV[2]; #this assumes you want to replace multiple of the #same type of file... or this script is useless @filelist = <*$glob>; if ( (!$find) || (!$replace) || (!$glob) ) { print "Input format <search_string> <replace_string> <file_wildcard>"; exit(0); } # process each file in file list foreach $filename (@filelist) { print " P: $filename\n"; # retrieve complete file open (IN, "$filename") || die("Error Reading File: $filename $!"); { undef $/; $infile = <IN>; } close (IN) || die("Error Closing File: $filename $!"); $infile =~ s/$find/$replace/g; # write complete file open (PROD, ">$filename") || die("Error Writing to File: $filename $!"); print PROD $infile; close (PROD) || die("Error Closing File: $filename $!"); } print "\nFinished.\n"; exit(0); -- Matt C.E. Wood | "If you enjoy what you do, you will wo...@wo... | never work another day in your life." | -- Confucious Ham Radio: KF4TBH | |