Andrew Benton wrote:
> On Tue, 13 Dec 2011 00:16:39 +0000
> Andrew Benton <[email protected]> wrote:
> 
>> On Mon, 12 Dec 2011 15:34:42 -0600
>> Bruce Dubbs <[email protected]> wrote:
>>
>>> Then why is is working for me?   Note 'sed -ir'
>> Sorry, I hadn't noticed the -r
>>
>>> $cat sedtest
>>> USEDLIBS module.a
>>>
>>> $ cat sedtest | sed -r -e '/^USEDLIBS/s# ([A-Za-z]*).a# -l\1#g'
>>> USEDLIBS -lmodule
>> Works the same here, but I don't know why. According to:
>> http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions
>>
>> "support is removed for \n backreferences", but if that's true then why
>> does the backreference work?

> However, when I try the commands as they are in the book I get this:
> 
> configure: creating ./config.status
...
> sed: -e expression #3, char 35: invalid reference \1 on `s' command's RHS

I think I made an error.  What my script has is:

  find -name Makefile -exec                                 \
         sed -ir -e '/^LIBRARYNAME/a SHARED_LIBRARY = 1'    \
                 -e 's#BUILD_ARCHIVE :*= 1#NO_&#'           \
                 -e '/^USEDLIBS/s# \([A-Za-z]*\).a# -l\1#g' \
                 -e 's#^USEDLIBS#LDFLAGS#' {} \;

The parens should be escaped.  That didn't make it into the book.


I'll fix it.

   -- Bruce
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to