Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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

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 pondering the Monastery: (6)
As of 2016-06-30 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (394 votes). Check out past polls.