i have a folder called 'error' and in that, i have error log
files which are generated by the build,
now i want to findout the string 'error' from each log
file and that error has to be copied into the another file
called 'analysis'.
how do you do this in perl?
Answer Posted / vipul dalwala
# Correction to my above post
$infile = 'errorlog.txt';
$outfile = 'analysys.txt';
open(INFILE,"$infile") || die "Unable to Open $infile-$!";
open(OUTFILE,">$outfile") || die "Unable to Open $outfile-
$!";
while ( <INFILE> ) {
print OUTFILE $_ if (/error/);
}
close INFILE;
close OUTFILE;
Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Explain perl.
What are prefix dereferencer?
Can we load binary extension dynamically?
Why -w argument is used with perl programs?
What is the difference between perl array and perl hash?
Explain use of ‘my’ keyword in perl?
List the operator used in Perl?
How do find the length of an array?
How can you use Perl warnings and what is the importance to use them?
how to connect cisco switch uisng perl script
Can inheritance be used in perl?
Explain what is lvalue?
How to connect with sqlserver from perl and how to display database table info?
What is the difference between use and require in perl programming?
What is the function of cgiwrap in cgi programming?