D
Deepu
Hi All,
I am trying to replace a word in a line with a different word.
Example:
File1:
THIS IS AN ERROR TEST
THIS IS A TEST
THIS IS NOT A TEST
I need to go through this file and check for ERROR in any line and
replace with FAIL.
Please help me on this.
Code:
#!/usr/local/bin/perl
$testFile = "File1";
open (FH, "$testFile") || die;
while (<FH>) {
chomp;
if ($_ =~ /ERROR/) {
print "$_\n"; ## I get the line with ERROR here
}
}
Thanks
I am trying to replace a word in a line with a different word.
Example:
File1:
THIS IS AN ERROR TEST
THIS IS A TEST
THIS IS NOT A TEST
I need to go through this file and check for ERROR in any line and
replace with FAIL.
Please help me on this.
Code:
#!/usr/local/bin/perl
$testFile = "File1";
open (FH, "$testFile") || die;
while (<FH>) {
chomp;
if ($_ =~ /ERROR/) {
print "$_\n"; ## I get the line with ERROR here
}
}
Thanks