Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 meditating upon the Monastery: (10)
As of 2015-06-02 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What kind of chocolate gives you the most pleasure?















    Results (97 votes), past polls