ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories >> Software >> Scripts >> CGI-Perl
 
 
 
Question
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?
 Question Submitted By :: Jkonakan
I also faced this Question!!     Rank Answer Posted By  
 
Answer
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)
 
0
Prabhath Kota
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com