Skip to content

Shell script for multi-file search and replace

A useful shell script for multi-file search and replace. Replace the .java with whatever extension you want

for i in `find . -name '*.java' -o -name '*.xml'`; do
   cp $i $i.temp
   sed -e 's/old text/new text/g' < $i.temp > $i
   rm $i.temp
   echo $i updated.
done

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*