Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How can I print three lines before pattern match?

by busunsl (Vicar)
on Aug 14, 2009 at 07:25 UTC ( #788550=note: print w/ replies, xml ) Need Help??


in reply to How can I print three lines before pattern match?

Do you have to use Perl?
Of course it has to be Perl! ;-)

Otherwise grep will do it:

grep -B3 pattern logfile


Comment on Re: How can I print three lines before pattern match?
Select or Download Code
Replies are listed 'Best First'.
Re^2: How can I print three lines before pattern match?
by neurotoxx (Novice) on Aug 14, 2009 at 20:42 UTC

    Unfortunately, I need to have it run as a Windows task. I also need it to traverse the log directory and process each file with the pattern match.

    Thanks,

    Neurotoxx

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-08 00:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls