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

From: Maxime Henrion <mux_at_freebsd.org>
Date: Mon, 15 Nov 2004 02:42:21 +0100
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
Received on Mon Nov 15 2004 - 00:42:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:22 UTC