One-line global string replace in all files with sed (or awk?)
atkielski.anthony at wanadoo.fr
Thu Jan 27 21:56:18 PST 2005
My thanks to all who replied. I ended up using this form (I don't
recall who suggested it):
find . -type f | xargs sed -i '' -e 's/foo/bar/g'
One problem, though: It appears that sed touches every file, resetting
the last modification time, even if it didn't actually change anything.
This reset the last modification dates for every file on my site, which
wasn't much fun. Is there another command I could put between find and
xargs that would filter only the names of files containing the string?
(grep would do it, but grep outputs the lines found to stdout, so that
More information about the freebsd-questions