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
Which guidelines by Perl modules must be followed?
How can you define “my” variables scope in Perl and how it is different from “local” variable scope?
What are the two ways to get private values inside a subroutine?
What are prefix dereferencer?
What is boolean context?
How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?
Elaborate on perl bite-wise operators.
What is the easiest way to download the contents of a URL with Perl?
Can you add two arrays together?
Write a program that shows the distinction between child and parent process?
What does the q{ } operator do?
What are the various perl data types based on the context?
How to convert strings into an array in perl?
How do I send e-mail from a Perl/CGI program on a Unix system?
What package you use to create a windows services?