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

# 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


Please Help Members By Posting Answers For Below Questions

What does the qq{ } operator do?

889


There are two types of eval statements i.e. Eval expr and eval block. Explain them.

941


How can you use Perl warnings and what is the importance to use them?

903


What does redo statement do in perl?

971


what is the difference between java and cgi?

1003


Explain which feature of PERL provides code reusability?

1152


What is chomp() operator/function?

994


What is eval function in perl?

901


Differences between die and exit.

944


Perl regular expressions are greedy" what does this mean?

852


Difference between the variables in which chomp function work ?

1009


How do you turn on the perl warnings?

857


Explain the meaning of subroutine?

904


List all the features of perl programming?

849


What can be done for efficient parameter passing in perl?

830