Date: Wed, 16 Jan 2002 22:16:09 -0500 From: parv <parv_@yahoo.com> To: Drew Tomlinson <drew@mykitchentable.net> Cc: f-q <freebsd-questions@freebsd.org> Subject: Re: Regular Expression Syntax Message-ID: <20020117031609.GA89501@moo.holy.cow> In-Reply-To: <003701c19f02$d6024af0$0301a8c0@bigdaddy> References: <200201170250.NAA05050@tungsten.austclear.com.au> <003701c19f02$d6024af0$0301a8c0@bigdaddy>
next in thread | previous in thread | raw e-mail | index | archive | help
in message <003701c19f02$d6024af0$0301a8c0@bigdaddy>, wrote Drew Tomlinson thusly... > > ----- Original Message ----- > From: "Tony Landells" <ahl@austclear.com.au> ... > > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020117031609.GA89501>