Let's make it faster! I did a Perl script to handle the string replacement for you!
#!/usr/bin/perl -W
use strict;
use warnings;
use IO::File;
print "Reset .XLA Password AS: ZZZZXXXX\n";
my $fname;
while ($fname = shift) {
my $fh = new IO::File;
my $fx = new IO::File;
# backup
#qx(copy $_ $_.orig) if [ -f $_ ];
# open file
if ($fh->open("< $fname")) {
$fh->binmode();
$fx->open("> $fname.new") || die qq(unable to create $fname.new! $@\n);
$fx->binmode();
my $l;
while ($l = <$fh>) {
$l =~ s/CMG="\w+"/CMG="C2C06EAE34B234B230B630B6"/;
$l =~ s/DPB="\w+"/DPB="848628F028AF45AF4550BBB0458ED7A55404135266B71BBB11B340F5CB0445BD26CDE2C6BA5A"/;
$l =~ s/GC="\w+"/GC="4644EA326E363137313731"/;
# write into new file.
print $fx $l;
}
$fh->close();
$fx->close();
# rename
qx(ren $fname $fname.orig);
qx(ren $fname.new $fname);
# print ok
print "$fname ... done!\n";
}
}
没有评论:
发表评论