Hey there,
This sometimes works...other times doesn't??
The file it's using looks like this and is cleand up:
<cleancondjil> (ref'd below) looks like:
condition: s(oldjob)
condition: s(oldjob)
---want to replace oldjob with newjob
the <jobs> file loading array from looks like:
oldjob,newjob
-----This is the Searcher file below
open (IN, "<jobs") or die "Can't open $in_file: $!\n";
while ( $line = <IN> ) {
@fields = split /\s*,\s*/,$line;
$line=$fields[0],@fields[0];
$line2=$fields[1],@fields[1];
chomp ($line);
chomp ($line2);
# print "\n";
print "this is OLDJ: $line\n";
print "this is NEWj: $line2\n";
my $job1 = $line;
my $job2 = $line2;
chomp ($job1);
chomp ($job2);
#Modifies conditions in OLDJOB JIL file: $job.depjil with NEW jobname - $job2
#This step changes JIL condition statements for jobs frmrly dep on $job1 to dep on $job2
print "NEW JIL for Jobs modifed to update from file cleancondjil and located in cleancondjil2\n";
open(DEPFILE, "<cleancondjil"); # open for input
open(DEPOUTFILE, ">cleancondjil2");
while(<DEPFILE>)
{
my($line) = $_;
# $line =~ tr/[a-z]/[A-Z]/;
$line =~ s!s\($job1\)!s\($job2\)!g;
# $line =~ s/ASNBRSCA_FW/\($job2\)/g;
$line =~ s/f\($job1\)/f\($job2\)/g;
$line =~ s/nr\($job1\)/nr\($job2\)/g;
$line =~ s/n\($job1\)/n\($job2\)/g;
$line =~ s/insert/update/g;
print DEPOUTFILE "$line";
# print "$job1\n";
# print "$job2\n";
# print "$line";
}
close(DEPFILE);
close(DEPOUTFILE);
}
close (IN);
This sometimes works...other times doesn't??
The file it's using looks like this and is cleand up:
<cleancondjil> (ref'd below) looks like:
condition: s(oldjob)
condition: s(oldjob)
---want to replace oldjob with newjob
the <jobs> file loading array from looks like:
oldjob,newjob
-----This is the Searcher file below
open (IN, "<jobs") or die "Can't open $in_file: $!\n";
while ( $line = <IN> ) {
@fields = split /\s*,\s*/,$line;
$line=$fields[0],@fields[0];
$line2=$fields[1],@fields[1];
chomp ($line);
chomp ($line2);
# print "\n";
print "this is OLDJ: $line\n";
print "this is NEWj: $line2\n";
my $job1 = $line;
my $job2 = $line2;
chomp ($job1);
chomp ($job2);
#Modifies conditions in OLDJOB JIL file: $job.depjil with NEW jobname - $job2
#This step changes JIL condition statements for jobs frmrly dep on $job1 to dep on $job2
print "NEW JIL for Jobs modifed to update from file cleancondjil and located in cleancondjil2\n";
open(DEPFILE, "<cleancondjil"); # open for input
open(DEPOUTFILE, ">cleancondjil2");
while(<DEPFILE>)
{
my($line) = $_;
# $line =~ tr/[a-z]/[A-Z]/;
$line =~ s!s\($job1\)!s\($job2\)!g;
# $line =~ s/ASNBRSCA_FW/\($job2\)/g;
$line =~ s/f\($job1\)/f\($job2\)/g;
$line =~ s/nr\($job1\)/nr\($job2\)/g;
$line =~ s/n\($job1\)/n\($job2\)/g;
$line =~ s/insert/update/g;
print DEPOUTFILE "$line";
# print "$job1\n";
# print "$job2\n";
# print "$line";
}
close(DEPFILE);
close(DEPOUTFILE);
}
close (IN);