having spent the morning trying to work out how to pipe file paths from find into a perl edit-in-place operation, I thought i might as well leave the answer here for other searchers: Use xargs, in short, to pass the results in a properly separated way to the perl command.
(man xargs, man find and perldoc perlrun for the details.)
This example replaces all instances of /images/ with /other_images/ in all *.html files in or beneath the current directory.
find . -iname "*.html" -print0 | xargs -0 -n 1 perl -pi.bak -e "s/\/im +ages\//\/other_images\//ig" #or revised following comments below (for which thanks): find . -iname "*.html" -print0 | xargs -0 perl -pi.bak -e "s/\/images\ +//\/other_images\//ig"
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |