I just had a situation where I needed to replace one string with another
string in 200 files.
This is what I came up with, but I know there has to be a better way. Below
is my code.

"myfiles" contains a list of the files I need to scrub, one per line.

-------8<-----------------8<-----------------------
#!/usr/local/bin/perl -w
use strict;
$|++;


my @files = `cat myfiles` or die;
for (@files) {

        chomp;
        push @ARGV, $_;
}


$^I = ".bak";   # Got this from a previous message; thanks Peter!
while (<>) {

        s#/u01/app/webMethodsFCS#/u02/app/webMethodsFCSclone#g;
        print;

}
---------8<------------------8<-----------------------

Seems to me there should be a way to provide the filenames on the command
line
w/o having to read the list into an array first, but I tried using xargs
(this is unix) and a couple
of other things but couldn't figure it out.

Thanks for the help!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to