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 / prabhakaran m
## Go to that Directory
my $file_output = "output";
open(OUTFILEHANDLE,">$file_output") || die "Unable to open
the file : $file_output";
foreach my $input_file (`ls -1`) {
open(INFILEHANDLE,"$input_file") || die "Unable to
open the file : $input_file";
while (<INFILEHANDLE>) {
print OUTFILEHANDLE $_ if (/print header/);
}
}
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Explain lists in perl?
what are steps to do to lock the sony ericsson mobile with password?
Explain what is lvalue?
What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)
How do I sort a hash by the hash value?
Define operators used in perl?
what are the three groups involved in information sharing?
Explain socket programming in perl?
What is the use of '>>' in perl?
Why aren't Perl's patterns regular expressions?
How do you match one letter in the current locale?
What is cpan ? What are the modules coming under this?
We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?
How to copy a file in perl?
Explain join function in perl?