tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SUBST_SED and newline?



From: Georg Schwarz <georg.schwarz%freenet.de@localhost>
Subject: Re: SUBST_SED and newline?
Date: Wed, 9 Dec 2009 22:13:39 +0100

> 
> Am 07.12.2009 um 08:04 schrieb fulvio ciriaco:
> 
>> What about
>> SUBST_SED.xxx+= s/ab/a\\${.newline}b/g
>> ?
>> It works fine and is quite easy to manage.
> 
> for me it does not work. With
> 
> SUBST_SED.sysio= -e 's,^\#include <sys/io\.h>,\#ifndef
> __sun\\${.newline}\#include <sys/io.h>\\${.newline}\#endif,g'
> 
> 
> I get:
> 
> sed: 1: "s,^#include <sys/io\.h> ...": unescaped newline inside
> substitute pattern
> 
Funny,
because
all:
        sed "s/ab/a\\${.newline}b/g" test
works fine.
I guess it involves SUBST_SED being invoked inside a higher 
substitution level and that one needs to escape one level more,
such as:
SUBST_SED_XXX="s/ab/a\\\\${.newline}n/g"
Sorry, I should have checked better
Fulvio

> With
> 
> SUBST_SED.sysio= -e s,^\#include <sys/io\.h>,\#ifndef
> __sun\\${.newline}\#include <sys/io.h>\\${.newline}\#endif,g
> 
> I get:
> 
> /home/schwarz/pkg32/bin/pdksh: syntax error: `if' unmatched
> *** Error code 1
> 
> 
> 
>> Fulvio
>>
>> From: "OBATA Akio" <obache%netbsd.org@localhost>
>> Subject: Re: SUBST_SED and newline?
>> Date: Mon, 07 Dec 2009 14:07:37 +0900
>>
>>> On Sun, 06 Dec 2009 23:18:16 +0900, Georg Schwarz
>>> <georg.schwarz%freenet.de@localhost> wrote:
>>>
>>>> Is it possible to insert a newline into a file using SUBST_SED?
>>>
>>> Probably... sed requre bare newline, but it's hard to put it in
>>> Makefile...
>>>
>>> How about put such a sed script in files/xxx.sed, and
>>> SUBST_SED.xxx+=     -f ${FILESDIR}/xxx.sed
>>>
> 
> 
> that one works.
> 
> 
> -- 
> Georg Schwarz    http://home.pages.de/~schwarz/
> georg.schwarz%freenet.de@localhost  +49 151 11559652
> 
> 


Home | Main Index | Thread Index | Old Index