Note: Due to technical difficulties, the Archives are currently not up to date.
GMANE provides an alternative service for most mailing lists. c.f. bug 424647
List Archive: gentoo-admin
On Sat, 2005-12-24 at 11:58 -0800, J.A. wrote:
> Any regex containing ! or | operators seem to get
> interpreted by bash as a bash operator. This could
> be avoided by putting the regex into a (perl?) file
> but then I would have to memorize a bunch of stupid
> little file scripts or create a stupid little file
> containing the script every time.
>
> Here is one little example that doesn't work:
>
> # Filter everything except lines containing
> # token1 or token2
> locate something | grep token1|token2
>
> # Do not display lines with token3:
> locate something | grep !token3
>
> grep has a -v option which is the same as a regex
> !token3 but I can't figure out how to then get grep
> to recognize inverting more than one token such as
> !(token3|token4).
! and | are bash operators, you need to escape them unless they are
inside single-quotes. IIRC double quotes are interpeted by most shells,
and single quotes arn't.
# whatever | egrep 'token1|token2'
or # whatever |egrep token1\|token2
# whatever | grep \!token
or # whatever |grep '!token'
I like egrep over grep. I like regexp.
-Lares
--
Lares Moreau <lares.moreau@...> | LRU: 400755 http://counter.li.org
lares/irc.freenode.net |
Gentoo x86 Arch Tester | ::0 Alberta, Canada
Public Key: 0D46BB6E @ subkeys.pgp.net | Encrypted Mail Preferred
Key fingerprint = 0CA3 E40D F897 7709 3628 C5D4 7D94 483E 0D46 BB6E
|
| Attachment: |
|
signature.asc (This is a digitally signed message part)
|
|