Re: system audit
Lares Moreau <[email protected]> Sat, 24 Dec 2005 15:34:39 -0700
| Newsgroups | gmane.linux.gentoo.admin |
|---|---|
| Message-ID | <1135463679.7377.9.camel@localhost> |
--=-iUJXzQBItqbLQYxTouGb Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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. >=20 > Here is one little example that doesn't work: >=20 > # Filter everything except lines containing > # token1 or token2 > locate something | grep token1|token2 >=20 > # Do not display lines with token3: > locate something | grep !token3 >=20 > 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'=20 or # whatever |egrep token1\|token2 # whatever | grep \!token or # whatever |grep '!token' I like egrep over grep. I like regexp. -Lares --=20 Lares Moreau <[email protected]> | 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 =3D 0CA3 E40D F897 7709 3628 C5D4 7D94 483E 0D46 BB6E --=-iUJXzQBItqbLQYxTouGb Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDrcz+fZRIPg1Gu24RAiSMAJ4pcaVkdvAfePZIrZ0ke1BNmyQHCwCcCZVV cmBP+dgajPIzG+FAX2ssvnw= =7iw7 -----END PGP SIGNATURE----- --=-iUJXzQBItqbLQYxTouGb-- -- [email protected] mailing list