Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: perl one line for advanced grep (current line and next one)

by hdb (Prior)
on Sep 02, 2013 at 08:29 UTC ( #1051906=note: print w/ replies, xml ) Need Help??


in reply to perl one line for advanced grep (current line and next one)

Here is my humble variation:

perl -ne "print if /error/ || $last=~/error/; $last=$_;" test_log.txt


Comment on Re: perl one line for advanced grep (current line and next one)
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (16)
As of 2015-09-03 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (125 votes), past polls