Hello, I am trying to change all files in a directory that contain the
strings Satellite satellite and SATELLITE that I need to change to target,
Target and TARGET. Because many of these are C++ source files I need to
preserve the case. I was thinking of the following script:
 
#!/usr/bin/perl -w
#UNTESTED
 
@FilesInDirectory = <*.cpp *.hpp *.asc>;
foreach $FileName (@FilesInDirectory) {
            open(IN, $FileName);
            while<IN> {
$_ =~ s/satellite/target/;
$_ =~ s/Satellite/Target/;
$_ =~ s/SATELLITE/TARGET/;}
}
 
but this just doesn't seem as efficient as it can be. I was trying to think
of regex that could do it all in one line but it seemed so much simpler to
do it in three.
 
Any thoughts,
 
Tim
 


Reply via email to