From owner-freebsd-questions Wed Jan 16 19:14:24 2002 Delivered-To: freebsd-questions@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id D412A37B405 for ; Wed, 16 Jan 2002 19:14:19 -0800 (PST) Received: from sdn-ar-008dcwashp184.dialsprint.net ([63.178.91.224] helo=moo.holy.cow) by albatross.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16R30H-0003n7-00; Wed, 16 Jan 2002 19:14:14 -0800 Received: by moo.holy.cow (Postfix, from userid 1001) id EECAB50B8A; Wed, 16 Jan 2002 22:16:09 -0500 (EST) Date: Wed, 16 Jan 2002 22:16:09 -0500 From: parv To: Drew Tomlinson Cc: f-q Subject: Re: Regular Expression Syntax Message-ID: <20020117031609.GA89501@moo.holy.cow> Mail-Followup-To: Drew Tomlinson , f-q References: <200201170250.NAA05050@tungsten.austclear.com.au> <003701c19f02$d6024af0$0301a8c0@bigdaddy> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003701c19f02$d6024af0$0301a8c0@bigdaddy> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG in message <003701c19f02$d6024af0$0301a8c0@bigdaddy>, wrote Drew Tomlinson thusly... > > ----- Original Message ----- > From: "Tony Landells" ... > > drew@mykitchentable.net said: > > > How can I get the opposite? In other words, everything except > > > cvsup or portupgrade? > > > > What, you mean something like... > > > > -v, --invert-match > > Invert the sense of matching, to select non-match- > > ing lines. > > > > from the grep/egrep/fgrep/zgrep man page? ... > I just tried that and it returned everything but the cvsup. But it > did return the portupgrade line which I don't want. did you really try egrep? perhaps you used another grep or mistyped "portupgrade"(?). > I know from > reading somewhere that I'm supposed to be able to take the > "portupgrade|cvsup" and negate the expression to mean "every line > except those containing portupgrade or cvsup". over here, following two commands don't produce anything (thus extended grep w/ -v option works).... pkg_info | egrep -v 'portupgrade|cvsup' | egrep 'portupgrade|cvsup' pkg_info | grep -vE 'portupgrade|cvsup' | egrep 'portupgrade|cvsup' ...or you could just use awk to do work of grep... pkg_info | awk '/portupgrade|cvsup/ {print "pkg_deinstall " $1}' pkg_info | awk '! /portupgrade|cvsup/ {print "pkg_deinstall " $1}' - parv -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message