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 / prabhath kota

We can do it in a simple way through command line with the
use of grep functionality without writing a program for that.

Suppose your log files(err.log, err_others.log, ......) are
present in "logs" folder.

1) Go to that path first
2) logs]# grep -ir 'error' . > result.txt
(-i for ignore case, -r for recursive search)
3) Observe that, it will grep all the places where ever
'error' is present and keep it in result.txt
4) If you just want the file names alone which contains 'error'
logs]# grep -irl 'error' . > result.txt
(-i for ignore case, -r for recursive search,
-l for listing the files)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define say() function in perl?

908


Write a program to decode the data in the form using cgi programming

996


Which functions in perl allows you to include a module file. State their differences.

902


Explain cpan?

918


Why is it hard to call this function: sub y { "because" } ?

884


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

948


What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?

932


Explain the various characteristics of perl.

901


Is perl compiler or interpreter?

891


What is qq (double q)operator in perl?

974


Write a cgi program to show the header part?

920


Explain lists in perl?

929


Explain the different types of data perl can handle.

855


How to open and read data files with Perl

998


How to find the length of an array in perl?

971