Hello! On Mon, Jun 04, 2007 at 02:01:12PM +0200, Marc Espie wrote: >[...]
>Don't use for loops with find results, they do not scale well. >Also, beware of spaces in file. >For this kind of thing, I generally use 'while read' >find . -type f -name \*.htm -print|while read f; do sed s/old/new <"$f" >>"$f.new"; done This isn't safe wrt newlines in file names, either. A completely safe solution would be writing a small script: #! /bin/sh exec sed s/old/new/ < "$1" > "$1".new and using find . -type f -name \*.htm -exec /path/to/script {} \; or find . -type f -name \*.htm -print0 | xargs -0 -L 1 -r /path/to/script Kind regards, Hannah.