Anyone got a logfile script? - Help a n00b

Padraig Brady Padraig at
Thu Sep 12 05:42:14 EDT 2002

Daniel Stuart Kelly wrote:
> What I'm looking for is a little script when run will dig into a log file and 
> look for a variable.
> When it finds the variable I want it to print that line and the 20 or so right 
> above it to either screen or a plaintext file. 
> I know it sounds simple, but I've only started learning this and I've no idea 
> where to begin.. Any tips or pointers would also be helpful...
> Thanks
> /Daniel
would a "context grep" not be simpler?

grep --before-context=20 log.file


More information about the Python-list mailing list