From owner-freebsd-questions Mon Nov 11 14:35:45 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7020537B401 for ; Mon, 11 Nov 2002 14:35:44 -0800 (PST) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED73743E88 for ; Mon, 11 Nov 2002 14:35:43 -0800 (PST) (envelope-from blacherez@ac-bordeaux.fr) Received: from milouz.boece.foo (bordeaux-2-a8-62-147-54-80.dial.proxad.net [62.147.54.80]) by postfix4-1.free.fr (Postfix) with ESMTP id 2D531DC01; Mon, 11 Nov 2002 23:35:31 +0100 (CET) Received: by milouz.boece.foo (Postfix, from userid 1000) id AE29D35010; Mon, 11 Nov 2002 23:35:17 +0100 (CET) Date: Mon, 11 Nov 2002 23:35:17 +0100 From: Benoit Lacherez To: John Von Essen Cc: questions@FreeBSD.ORG Subject: Re: awk to remove backet Message-ID: <20021111233517.A28946@milouz.boece.foo> References: <20021111225743.A7718@milouz.boece.foo> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from john@essenz.com on Mon, Nov 11, 2002 at 05:19:49PM -0500 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 John Von Essen a écrit : > Im confused. > > Wouldn't s/(\([^)]*\))/\1/g just replace exactly what it finds? I think > the outer ()'s got mixed up. No. sed doesn't use extended regex so the special character is \( and the literal bracket is (. The easiest is to try: % echo '(abc.com)' | sed 's/(\([^)]*\))/\1/g' abc.com % echo '(abc.com)' | sed 's/\(([\w]+)\)/\1/g' (abc.com) > > To take (hello) and change it to hello, you would do: > > sed 's/\(([\w]+)\)/\1/g' > > \w is fine if you only want the cases where text only is inside. > > -John Von Essen > > On Monday, November 11, 2002, at 04:57 PM, Benoit Lacherez wrote: > > > What about sed 's/(\([^)]*\))/\1/g' ? > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Benoit Lacherez Académie de Bordeaux -- CATICE Projet de traduction de la documentation de Python: http://frpython.sourceforge.net/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message