# # loop over all c files looking for the string, # then edit the file with sed. all changed files # are first saved in the bak subdirectory # for FILEN in `grep -l "dcool" *.c` do BNAME=`basename $FILEN .c` echo $BNAME.c cp $BNAME.c bak/$BNAME.bak sed -f swapstring.sed < ${BNAME}.c > temp.xx mv temp.xx ${BNAME}.c done