How to sed search and replace without changing ownership
Posted
by Ian
on Stack Overflow
See other posts from Stack Overflow
or by Ian
Published on 2010-04-09T19:10:26Z
Indexed on
2010/04/09
19:13 UTC
Read the original article
Hit count: 354
I found this command line search and replace example:
find . -type f -print0 | xargs -0 sed -i 's/find/replace/g'
It worked fine except it changed the date and file ownership on EVERY file it searched through, even those that did not contain the search text.
What's a better solution to this task?
Thanks.
© Stack Overflow or respective owner