C
Chris Nolte
I want to write a Perl script to modify a bunch of my programming run
scripts, where each script will have a number of lines that need to be
incremented.
Here is what I have tried:
#!/usr/bin/perl -w
use strict;
foreach my $in (glob "run.cctm*") {
chomp($in);
open IN, "<$in" or die "can't open $in for input\n";
my $out = "$in.new";
open OUT, ">$out" or die "can't open $out for output\n";
while (<IN>) {
s,NEXTDAY\s*=\s*jul(\d+),NEXTDAY = jul$1+1,;
print OUT;
}
close IN;
close OUT;
}
original: set NEXTDAY = jul22
desired : set NEXTDAY = jul23
result : set NEXTDAY = jul22+1
Thanks for any help on how to do this.
Chris
scripts, where each script will have a number of lines that need to be
incremented.
Here is what I have tried:
#!/usr/bin/perl -w
use strict;
foreach my $in (glob "run.cctm*") {
chomp($in);
open IN, "<$in" or die "can't open $in for input\n";
my $out = "$in.new";
open OUT, ">$out" or die "can't open $out for output\n";
while (<IN>) {
s,NEXTDAY\s*=\s*jul(\d+),NEXTDAY = jul$1+1,;
print OUT;
}
close IN;
close OUT;
}
original: set NEXTDAY = jul22
desired : set NEXTDAY = jul23
result : set NEXTDAY = jul22+1
Thanks for any help on how to do this.
Chris