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

Zoltan Frombach tssajo at hotmail.com
Sun Nov 14 18:11:19 PST 2004


Thanks. I will not use the -E flag then.

Zoltan

> 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


More information about the freebsd-stable mailing list