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
$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 ? | 2 Yes | 2 No |
Post New Answer View All Answers
Write a script to reverse a string without using perl's built in functions?
What is the different between array and hash in perl programming?
What are the advantages of c over Perl?
What are scalars in perl?
What is the use of now constructor in perl?
What are the different types of perl operators?
What value is returned by a lone `return;’ statement?
What are the reasons that cookie server can’t handle multiple connections?
What are the steps involved in configuring a server using cgi programming?
Give an example of the -i and 0s option usage.
What are arrays in perl?
What is the use of -t?
What are the advantages of perl programming?
How to create a directory in perl?
What is the purpose of _package_ literal?