Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Nov 2004 02:42:21 +0100
From:      Maxime Henrion <mux@freebsd.org>
To:        Zoltan Frombach <tssajo@hotmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Either I do something wrong or there is a regexp bug in sed !!
Message-ID:  <20041115014221.GF32839@elvis.mu.org>
In-Reply-To: <BAY2-DAV8cm9t0CI76r0001ef19@hotmail.com>
References:  <BAY2-DAV16kTgbLYluL0001ec55@hotmail.com> <1100476106.10768.4.camel@rushlight.kf8nh.com> <BAY2-DAV8cm9t0CI76r0001ef19@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041115014221.GF32839>