for i in `grep -iR ‘\/usr\/bin\/perl’ * | cut -f 1 -d ‘:’ |  sed ‘s/.*/”&”/’`; do sed ‘s/\/usr\/bin\/perl/\/opt\/lampp\/bin\/perl/g’ $i > /tmp/TMPFILE && mv /tmp/TMPFILE $i ; done

Update: the bold text expression wraps with double quotes the filenames, so the problem with spaces in filenames should dissapear. Thanks Tripu :)

About these ads