Either I do something wrong or there is a regexp bug in sed !!

Maxime Henrion mux at freebsd.org
Sun Nov 14 17:46:31 PST 2004


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 at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"




More information about the freebsd-current mailing list