From owner-freebsd-current@FreeBSD.ORG Mon Nov 15 00:06:02 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7930F16A4CE; Mon, 15 Nov 2004 00:06:02 +0000 (GMT) Received: from hotmail.com (bay2-dav8.bay2.hotmail.com [65.54.246.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id 580E643D1D; Mon, 15 Nov 2004 00:06:02 +0000 (GMT) (envelope-from tssajo@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 14 Nov 2004 16:06:01 -0800 Received: from 24.24.201.219 by BAY2-DAV8.phx.gbl with DAV; Mon, 15 Nov 2004 00:05:14 +0000 X-Originating-IP: [24.24.201.219] X-Originating-Email: [tssajo@hotmail.com] X-Sender: tssajo@hotmail.com From: "Zoltan Frombach" To: "Brandon S. Allbery KF8NH" References: <1100476106.10768.4.camel@rushlight.kf8nh.com> Date: Sun, 14 Nov 2004 16:05:15 -0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: X-OriginalArrivalTime: 15 Nov 2004 00:06:01.0905 (UTC) FILETIME=[E46E9210:01C4CAA6] 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-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2004 00:06:02 -0000 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. Zoltan > On Sun, 2004-11-14 at 18:39, Zoltan Frombach wrote: >> match anything! After spending like an hour investigating this, I >> realized >> that the + after my bracket expression ( I'm talking about this part >> here: > > Normal. > >> According to the sed man page, the regexp syntax that is used by sed is >> documented in the re_format man page. And according to the re_format man >> page: "A piece is an atom possibly followed by a single= `*', `+', `?', >> or > > You need to read it more carefully. There are two kinds of regular > expressions, "basic" and "extended". sed, ed, and grep speak BRE > syntax, whereas awk and egrep speak ERE syntax. + is special only in > ERE syntax. > > (And then there's GNU, where the difference between BRE and ERE is that > some things use a preceding backslash in BRE and don't in ERE, and vice > versa, so GNU sed does what you want if you use \+ instead of +.) > > -- > brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com > system administrator [WAY too many hats] allbery@ece.cmu.edu > electrical and computer engineering, carnegie mellon univ. KF8NH