Re: [ILUG] [OT] text replacement recursively ?

From: Stephen Shirley (diamond at domain skynet.ie)
Date: Wed 25 Sep 2002 - 15:11:02 IST


On Wed, Sep 25, 2002 at 02:31:44PM +0100, Padraig Brady wrote:
> The disadvantage is that you create a new file even if there are no changes.

Hmm. Is that really such a big disadvantage?

> You could do a diff before the mv to get around this like.

Umm, i'm unsure what you mean here. Do a diff against what?
Do you mean something like:

if { sed 's/pattern/blah/' | diff file -; }; do
        mv file file.old
        sed 's/pattern/blah/' file.old > file
done

?? Because, if so, unless disk space is at a preimum, or you're dealing
with rather large files, i really don't see how that's worth worrying
about. But, i could easily have mis-understood what you meant, or just
generally screwed up.

> Note also that super sed does inplace editing.
>
Hmm. Not installed anywhere near me by default, but i see the next
version of gnu sed will be based on it. Yummy.

Steve

-- 
High salt diets are bad for you - but only outside marriage.


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:19:04 GMT