Is it possible in WildEdit to search files that lay on a specific path or path fragment?
Here's the problem, our beloved IT department has changed our CVS server's name and I need to update all references to the CVS instance. These are kept in a file called 'Root' that lives in a folder called 'CVS' in all the directories that are managed by CVS.
The actual replace is a simple edit that swaps "sunserv09" for "cvs" in the file 'Root'. Is it possible to get WildEdit to only look for
CVS\Root
i.e., files called 'Root' that are in a directory called 'CVS' and ignore any file called 'Root' in any other parent directory?
Searching specific path
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
I don't believe this is possible in WildEdit.
But if you use CVS, you should have no trouble with a scripting language, for example, Perl:
But if you use CVS, you should have no trouble with a scripting language, for example, Perl:
Code: Select all
use File::Find ;
my $ext = '.orig' ;
find \&doIt, '.' ;
sub doIt ()
{
if ( $File::Find::dir =~ m|/CVS$| && $_ eq 'Root' )
{
print "$File::Find::name\n" ;
my $new = $_ ;
my $bup = "$new$ext" ;
rename $new, $bup or die "Can't back up $File::Find::name: $!\n" ;
open BUP, "<$bup" or die "Can't open $File::Find::name$ext: $!\n" ;
open NEW, ">$new" or die "Can't open $File::Find::name: $!\n" ;
for my $line ( <BUP> )
{
$line =~ s/cvs/sunserv09/ ;
print NEW $line ;
}
close NEW ;
close BUP ;
}
}
Thanks
Thanks for the input Ben. In the end I wrote a Python script to do much the same sort of thing.