Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by hdb (Parson)
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 exploiting the Monastery: (3)
As of 2014-07-13 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (249 votes), past polls