Re: sed --in-place bug (updates mtime of file even if no changes are made)
John Cowan <[email protected]>
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
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 [email protected] somefile; then > sed --in-place 's/[email protected]/[email protected]/' > fi Or, more efficiently: grep -r -q [email protected] /the/root/place | xargs sed --in-place s/foo@a/bar@b/ -- Note that nobody these days would clamor for fundamental laws John Cowan of *the theory of kangaroos*, showing why pseudo-kangaroos are [email protected] physically, logically, metaphysically impossible. http://www.ccil.org/~cowan Kangaroos are wonderful, but not *that* wonderful. --Dan Dennett on zombies