eileen1017
MIS
I have a file called oratabtest. The content of the file as follows:
atest:/apps/oracle/product/9.2.0:Y
btest:/apps/oracle/product/9.2.0:Y
ctest:/apps/oracle/product/9.2.0:Y
dtest:/apps/oracle/product/9.2.0:Y
I need to write a perl script to read into the file and if ctest then change the Y to N without modify other lines. So far, I come up with the following:
#!/usr/bin/perl
open (REPORT, ">oratabtest")||die "Can't open report file!\n";
COUNTERLOOP:while ($line = <REPORT>) {
chomp($line);
$a1=substr($line, 0, 5);
$a2=substr($line, 33, 1);
if ($a1 eq "ctest"){
substr($line, 33, 1, "N") if ($a2 eq "Y");
}
print "$line\n"; #for debugging
}
close (REPORT);
Well, apparently what I wrote does not work. I am not sure if any body has any idea about this? Thanks for your help.
atest:/apps/oracle/product/9.2.0:Y
btest:/apps/oracle/product/9.2.0:Y
ctest:/apps/oracle/product/9.2.0:Y
dtest:/apps/oracle/product/9.2.0:Y
I need to write a perl script to read into the file and if ctest then change the Y to N without modify other lines. So far, I come up with the following:
#!/usr/bin/perl
open (REPORT, ">oratabtest")||die "Can't open report file!\n";
COUNTERLOOP:while ($line = <REPORT>) {
chomp($line);
$a1=substr($line, 0, 5);
$a2=substr($line, 33, 1);
if ($a1 eq "ctest"){
substr($line, 33, 1, "N") if ($a2 eq "Y");
}
print "$line\n"; #for debugging
}
close (REPORT);
Well, apparently what I wrote does not work. I am not sure if any body has any idea about this? Thanks for your help.