in reply to inplace edit
Try this instead:
find . -name '*.c' -exec perl -pi.bak -e 's/name1/name2' {} \; [download]