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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Scripts  >>  CGI Perl
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
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  
 
  Re: 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
# 1
grep error ~/error/errorlog.txt >> ~/main/analysis.txt
 
Is This Answer Correct ?    0 Yes 0 No
Jyothsna
 
  Re: 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
# 2
$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 ?    0 Yes 0 No
Vipul Dalwala
 
 
 
  Re: 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
# 3
# 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 ?    0 Yes 0 No
Vipul Dalwala
 
  Re: 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
# 4
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 ?    0 Yes 0 No
Prabhath Kota
 

 
 
 
Other CGI Perl Interview Questions
 
  Question Asked @ Answers
 
How can you create an object of a class in a package? IBM2
Explain the difference between use and require?  2
How to find out the version of PERL being installed on your LINUX machine. Mind-Tree3
What do the symbols $ @ and % mean when prefixing a variable?  1
What is the difference between module and package? IBM1
What?s your favorite module and why?  1
I have created a CGI-based page,after entering all the values in to the fields, How to get the output on the web browser using Perl  4
What is the Common Gateway Interface?  1
what is the difference between require and use in perl? IBM1
What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?  1
Explain the difference between my and local?  1
What is the difference between chop & chomp functions in perl? Cap-Gemini4
What are the characteristics of a project that is well suited to Perl?  1
How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environment ?  4
What is a hash? Satyam5
what r the different type of function in perl ??? Symphony1
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? HP4
how to install a package in perl ????  1
How would you trap error occurred in the perl program/file? IBM2
What purpose does each of the following serve: -w, strict, - T ?  2
 
For more CGI Perl Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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