Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 avoiding work at the Monastery: (13)
As of 2016-04-28 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW







    Results (435 votes). Check out past polls.