From owner-freebsd-questions Thu Jan 17 7:59: 8 2002 Delivered-To: freebsd-questions@freebsd.org Received: from relay04.roc.frontiernet.net (alteon01e.roc.frontiernet.net [66.133.130.235]) by hub.freebsd.org (Postfix) with SMTP id CAF4737B423 for ; Thu, 17 Jan 2002 07:58:52 -0800 (PST) Received: (qmail 28551 invoked from network); 17 Jan 2002 15:58:46 -0000 Received: from unknown (HELO blacklamb.mykitchentable.net) ([207.173.227.80]) (envelope-sender ) by relay04.roc.frontiernet.net (qmail-ldap-1.03) with SMTP for ; 17 Jan 2002 15:58:46 -0000 Received: from tagalong (unknown [165.107.42.196]) by blacklamb.mykitchentable.net (Postfix) with SMTP id 09F62EE651; Thu, 17 Jan 2002 07:58:44 -0800 (PST) Message-ID: <004f01c19f6f$d72336c0$c42a6ba5@lc.ca.gov> From: "Drew Tomlinson" To: Cc: "Tony Landells" , "Erik Trulsson" , "parv" , "Jim Conner" , "Kent Stewart" References: <000b01c19f00$d396db20$0301a8c0@bigdaddy> Subject: Re: Regular Expression Syntax - SOLVED Date: Thu, 17 Jan 2002 07:58:43 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 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 ----- Original Message ----- From: "Drew Tomlinson" To: Sent: Wednesday, January 16, 2002 6:44 PM Subject: Regular Expression Syntax > I've been beating my head and just can get the syntax of this right. > This expression works: > > blacklamb> pkg_info | egrep "portupgrade|cvsup" | awk '{print > "pkg_deinstall " $1}' > pkg_deinstall cvsup-16.1_3 > pkg_deinstall portupgrade-20011210 > > How can I get the opposite? In other words, everything except cvsup > or portupgrade? I know about the ! and () for grouping but can't seem > to get it in the right place. Help. Thank you to all that responded. As in most cases, there are many ways to accomplish this task. These are the things I learned: 1. There is not a "not" operator for the various "greps" in FBSD. I don't know about other *nixs but then this is a FBSD list so it really doesn't matter. 2. To use a "not", use the -v switch with grep as documented in the man page. 3. Parv pointed out that in this example, grep isn't needed as awk can perform the "everything except this" function. Here was his example: pkg_info | awk '! /portupgrade|cvsup/ {print "pkg_deinstall " $1}' 4. And finally, Kent Stewart figured out what I was attempting to do and suggested deleting all packages, installing CVSUP from packages, and then installing portupgrade and all of it's dependencies. Thank you all for helping me learn to tie all of the basics together to perform more complex commands. Now I'm *REALLY* starting to understand and appreciate the power of FBSD. Drew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message