On Tue, Apr 30, 2002 at 03:40:20PM -0700, Palit, Nilanjan wrote:
> This is really a unix question, but I thought I'll ask it here, in case
> there is a perl tool to do the same:
> 
> Is there an (easy) way of doing a grep with a 'context', i.e. grep will
> provide the previous N & next M lines for every line that matches the
> pattern (where N & M are arguments to the command)?

No.  You could lash something up by making grep spew out line numbers and
then feeding them to awk.

-- 
David Cantrell    |    Degenerate    |    http://www.cantrell.org.uk/david

  With ... the fact that Linux has become so easy to install that
  certain species of bacteria are now being hired by MIS departments,
  what was once the domain of rigorously trained, highly specialized
  professionals has devolved into the Dark Land of the Monkeys.
     -- Greg Knauss

Reply via email to