Return to Snippet

Revision: 56385
at March 24, 2012 12:45 by irishsk


Initial Code
!/bin/bash

 FOLDER="/Users/path/to/test/original/"
 echo "******************************************"
 echo enter word to replace
 read searchterm
 echo enter word that replaces
 read replaceterm



   for file in $(grep -l -R $searchterm $FOLDER) 


      do

   sed -e "s/$searchterm/$replaceterm/g" $file > /Users/path/to/test/tmp/tempfile.tmp 
       mv /Users/path/to/test/tmp/tempfile.tmp $file

       echo "Modified: " $file

    done




   echo " *** All Done! *** "

Initial URL

                                

Initial Description
Nix search replace using sed

Initial Title
Nix search and replace

Initial Tags

                                

Initial Language
Bash