Gentoo Logo
Gentoo Spaceship

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
Lists: gentoo-admin: < Prev By Thread Next > < Prev By Date Next >
To: gentoo-admin@g.o
From: Lares Moreau <lares.moreau@...>
Subject: Re: system audit
Date: Sat, 24 Dec 2005 15:34:39 -0700
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 Moreau <lares.moreau@...>  | LRU: 400755
lares/                 |
Gentoo x86 Arch Tester                 |               ::0 Alberta, Canada
Public Key: 0D46BB6E @ |          Encrypted Mail Preferred
Key fingerprint = 0CA3 E40D F897 7709 3628  C5D4 7D94 483E 0D46 BB6E
signature.asc (This is a digitally signed message part)
system audit
-- J.A.H.
Re: system audit
-- Alex
Re: system audit
-- J.A.
Lists: gentoo-admin: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: system audit
Next by thread:
Re: system audit
Previous by date:
Re: system audit
Next by date:
Re: system audit

Updated Jun 17, 2009

Summary: Archive of the gentoo-admin mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.