From owner-freebsd-stable@FreeBSD.ORG Mon Nov 15 01:42:21 2004 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7845B16A4CE; Mon, 15 Nov 2004 01:42:21 +0000 (GMT) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5E53E43D2D; Mon, 15 Nov 2004 01:42:21 +0000 (GMT) (envelope-from mux@freebsd.org) Received: by elvis.mu.org (Postfix, from userid 1920) id 52F475CA3E; Sun, 14 Nov 2004 17:42:21 -0800 (PST) Date: Mon, 15 Nov 2004 02:42:21 +0100 From: Maxime Henrion To: Zoltan Frombach Message-ID: <20041115014221.GF32839@elvis.mu.org> References: <1100476106.10768.4.camel@rushlight.kf8nh.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i cc: freebsd-current@freebsd.org cc: freebsd-stable@freebsd.org Subject: Re: Either I do something wrong or there is a regexp bug in sed !! X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2004 01:42:21 -0000 Zoltan Frombach wrote: > You are right. My mistake. This indeed works: > > sed -E -e "s/^[0-9]+/199/" conf-split > conf-split.new > > Thanks for clearing this up. For what it's worth, there is another way to write this regexp without using the -E flag. Since x+ == xx*, you can write it: "s/^[0-9][0-9]*/199/". The reason for not using -E is that it's not portable, since it's not specified by the standard. GNU sed uses -r for extended REs. Cheers, Maxime