On 10 Feb 2006 at 0:35, Peter Pan wrote:

> OK. How would I do this in perl. I guess I could write a script to
> call my perl script that runs this command
> 
> --- In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote:
> >
> > >>>>> "Peter" == Peter Pan <[EMAIL PROTECTED]> writes:
> > 
> > Peter> I have multiple log files that are being created during my 
> build. At
> > Peter> the end of each build, I copy the log file to 1 master log 
> file.  I
> > Peter> need a way using sed or awk where I can scan the master 
> files for
> > Peter> "Error: building module..."  If this pattern is hit I need 
> to copy
> > Peter> that line and up 25 lines into a new file error.log.  
> > 
> > Peter> Any suggestions???
> > 
> > Yes, don't use sed or awk.  Use Perl.


I think this might do it, presuming you have access to cat or 
similar.

cat logfile.log | perl -e 'while (<>) { print if /Error/ }'

`perldoc perlrequick` would have given you the answer just as 
quickly.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to