bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sed --in-place bug (updates mtime of file even if no changes are mad


From: John Cowan
Subject: Re: sed --in-place bug (updates mtime of file even if no changes are made)
Date: Mon, 12 Dec 2011 20:10:56 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

Bob Proulx scripsit:

> BTW...  Whenever I need to do something like this I always grep first
> and edit only if the grep tells me that I need to do something.  That
> way the file isn't modified if there isn't any change to it.
> 
>   if grep -q address@hidden somefile; then
>     sed --in-place 's/address@hidden/address@hidden/'
>   fi

Or, more efficiently:

grep -r -q address@hidden /the/root/place | xargs sed --in-place 
s/address@hidden/address@hidden/

-- 
Note that nobody these days would clamor for fundamental laws        John Cowan
of *the theory of kangaroos*, showing why pseudo-kangaroos are   address@hidden
physically, logically, metaphysically impossible.    http://www.ccil.org/~cowan
Kangaroos are wonderful, but not *that* wonderful.     --Dan Dennett on zombies



reply via email to

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