gnu-arch-users
[Top][All Lists]
Advanced

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

Re: [Gnu-arch-users] new version hook script examples


From: Zenaan Harkness
Subject: Re: [Gnu-arch-users] new version hook script examples
Date: Wed, 10 Nov 2004 14:29:06 +1100

On Sun, 2004-09-26 at 10:33, Zenaan Harkness wrote:
> On Sun, 2004-09-26 at 10:22, Andrew Suffield wrote:
> > On Sun, Sep 26, 2004 at 10:13:30AM +1000, Zenaan Harkness wrote:
> > > On Sun, 2004-09-26 at 03:47, Stig Brautaset wrote:
> > > > On Sat, Sep 25, 2004 at 12:26:54PM +1000, Zenaan Harkness wrote:
> > > > > sed -e "s/$VERSION_SED_STRING/$RELEASE_DATE/" D.java > D.java
> > > > 
> > > > I'm surprised if this works as you (seem to) expect. I worry that the
> > > > redirection will nuke the content of the file before it is opened by
> > > > sed. Either use (relatively) recent gnu sed with the -i flag or
> > > > something like this:
> > > > 
> > > > sed -e "s/$VERSION_SED_STRING/$RELEASE_DATE/" D.java > ,D.java && \
> > > >   mv ,D.java D.java
> > > 
> > > I was thinking that too you know ... but empirically, it works,
> > > so I never bothered adding the redirection.
> > 
> > It should never work. Something's wrong if it does.
> 
> OK, you're right - I had two versions, one "embedded" which I was using
> (and forgot about) as per:
> 
> SRC_MUNGE_FILE=$SRC/cpc/D.java
> DST_MUNGE_FILE=$DST/D.java
> sed -e "s/cpc_Release_Version/$RELEASE_DATE/" $SRC_MUNGE_FILE >
> $DST_MUNGE_FILE
> 
> Sorry for confusing anyone,
> Zen

BTW, does anyone know/ use an alternative to perl -i for in-place
munging? I guess I should learn how to chain multiple lines such as the
following into one, since firing up perl for each line seems rather
heavy weight.

perl -pi -e "s#SUB_WEB_HOST#$SUB_WEB_HOST#g;" $SED_FILES
perl -pi -e "s#SUB_server.host#$SUB_server_host#g;" $SED_FILES
...

??

tia
zen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]