Date: Sun, 14 Nov 2004 16:05:15 -0800 From: "Zoltan Frombach" <tssajo@hotmail.com> To: "Brandon S. Allbery KF8NH" <allbery@ece.cmu.edu> Cc: freebsd-stable@freebsd.org Subject: Re: Either I do something wrong or there is a regexp bug in sed !! Message-ID: <BAY2-DAV8cm9t0CI76r0001ef19@hotmail.com> References: <BAY2-DAV16kTgbLYluL0001ec55@hotmail.com> <1100476106.10768.4.camel@rushlight.kf8nh.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BAY2-DAV8cm9t0CI76r0001ef19>