On 2007/06/04 01:04, David B. wrote: > Find . -name "*.htm" -exec 'sed s/old/new/' > '{}'.new > > From what I've read, I should be able to use the '{}' as a global replace;
you pass {} to the shell as part of the filename to redirect the output from find(1) to, it is not seen by find(1) at all (and you don't pass the filename to sed, either). if you want to redirect via -exec you can do it like this: $ find . -name '*.htm' -exec sh -c 'sed s/old/new/ < {} > {}.new' \; but do you know about the simpler perl options for in-place editing? see perlrun(1) about the -i option, here are the more common forms: $ perl -pi.orig -e 's,foo,bar,' *.htm (with backup) $ perl -pi -e 's,foo,bar,' *.htm (without)