Fellow Monks, I have a rather stupid question ...

I am hunting for a specific set of values in my log file and want to print out 'n' lines from above and below the match.
I have the following tiny piece which I know is horribly wrong. Just spits out the matching lines alone. I have been working on pieces of a huge module and I am just too tired to think right. Any quick pointers on how I can proceed would be greatly appreciated ...
open (LOG, "GWSvc.log") || die "Unable to get a handle to the file: $! +\n"; while (<LOG>) { if (/c9391b56-b174-441b-921c-7d63/) { $. = ($. - 5); for (my $i=0;$i<=10;$i++) { print; $.++; } } }

Pl. note that the log runs into a few 100 megs and my sorry system can't really load all of it into memory
Thanks

In reply to grab 'n' lines from a file above and below a /match/ by barathbr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.