Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-admin
Navigation:
Lists: gentoo-admin: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-admin@g.o
From: Lares Moreau <lares.moreau@...>
Subject: Re: system audit
Date: Sat, 24 Dec 2005 15:34:39 -0700

 1.1

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)
References:
system audit
-- J.A.H.
Re: system audit
-- Alex
Re: system audit
-- J.A.
Navigation:
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


May 28, 2008

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.