On 6/4/07, David B. <[EMAIL PROTECTED]> wrote:
hi, I'm using 3.8, and I hate to bother, but I have spent two days on the net trying to find the answer to this problem.I am using 'find' to batch file a sed search and replace. Sed, of course, outputs to stdout, the problem I am having is finding the correct syntax so that I can change the extension of the input file to create the new output file. For example: 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; so if the input file happens to be smith.htm, then '{}' would be smith.htm and the idea is that the output filename for the sed command would create a new output file called smith.htm.new.
I'd probably use a for loop. *untested* for i in *.html ; do mv $i `echo $i | sed 's/\(.*\.\)html/\1html.new/'` ; done --Bryan

