bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tr: Problem with grep v2.5.1


From: Andreas Schwab
Subject: Re: Tr: Problem with grep v2.5.1
Date: Sat, 19 May 2007 00:32:30 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux)

address@hidden (Paul Jarc) writes:

> Simon Nieux <address@hidden> wrote:
>>>     grep -B 3 "\.\.\.[0-9]\{3\}" wget.log | grep -v -B 3 "\.\.\.200"
>
> That means that th second grep will print every line that doesn't
> match "\.\.\.200", and the three lines preceding each of those lines.
> To get what you want using grep, you'd need a different pattern in
> place of "\.\.\.[0-9]\{3\}" that inherently excludes "...200" without
> using -v:
> grep -E -B 3 '\.\.\.([013-9][0-9]{2}|2[1-9][0-9]|20[1-9])'

Or exclude first, then grep the general pattern (although that will get
the context slightly wrong):

$ grep -v "\.\.\.200" wget.log | grep -B 3 "\.\.\.[0-9]\{3\}"

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]