find . -name '.htaccess' -type f -exec perl -pi -e 's/local\/sites/srv\/www/g' {} \; Find all files with the name .htaccess, thats a real file, then execute a line line perl script to replace local/sites with srv/www (using \ to escape the /) -----