"Marcello Cruz" <marcello.c...@globo.com> wrote:

> Dear friends,
>
> I've read the documentation about sed - sed(8), re_format(7) and 
> /usr/share/doc/usd/15.sed/ - but I still don't realize how to make this 
> command work:
>
> $ s/(^[A_Z]{1})([a-z]+)\.sgml/\1\2\.html/g
>
> As I read I must prefix the '{', '}', '(' and ')' with backslashes. Even if 
> I do so, the command does not work. The command should take a filename 
> starting with a capital letter followed with the extension 'sgml' and 
> translate the extension to 'html'.
>
> Accordingly to http://www.bsd.org/regexintro.html it should work, but it 
> does not.
>
> I think there is some bug with the implementation of sed or the "branch" 
> (one or more pieces concatenated - as stated under re_format) is not 
> supported with BRE.
>
> Someone could clarify this to me, please? Also, how do I get the expected 
> result?
>
> Rgds
> Marcello

You didn't read re_format(7) well: 

     Basic regular expressions differ in several respects:

        o   `|', `+', and `?' are ordinary characters and there is no equiva-
            lent for their functionality.

        o   The delimiters for bounds are `\{' and `\}', with `{' and `}' by
                    themselves ordinary characters.

$ sed -e 's/\(^[A_Z]\{1\}\)\([a-z]\{1,\}\)\.sgml/\1\2\.html/g'


Saludos.

--
DISCLAIMER: http://goldmark.org/jeff/stupid-disclaimers/ 
This message will self-destruct in 3 seconds.

Reply via email to