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
What does the qq{ } operator do?
What is the importance of perl warnings?
What is a chomp() function in perl?
Why do you use Perl?
What is “grep” function in perl?
Write a program that shows the distinction between child and parent process?
Explain chop?
How can you call a subroutine and identify a subroutine?
Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)
What are the arguements we normally use for perl interpreter?
What are the different instances used in cgi overhead?
what are prefix dereferencer and list them out?
What is perl programming?
How to determine strings length in perl?
What are perl strings?