Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are the different string manipulation operators in perl?

863


What are the different ways to run cgi?

906


What is the function of cgiwrap in cgi programming?

865


What are the reasons that cookie server can’t handle multiple connections?

903


How do I send e-mail from a Perl/CGI program on a Unix system?

956


What is perl push array function?

884


Explain perl. When do you use perl for programming?

830


What is perl unshift array function?

941


Explain perl.

885


Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

971


Explain cpan?

907


What is q (single q) operator in perl?

1002


What are the options that can be used to avoid logic errors in perl?

891


How can you call a subroutine and identify a subroutine?

938


How to find the length of an array in perl?

965