Skip to content

Instantly share code, notes, and snippets.

@sandeepmukho
Last active December 24, 2015 23:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeepmukho/5757798 to your computer and use it in GitHub Desktop.
Save sandeepmukho/5757798 to your computer and use it in GitHub Desktop.
Shell commands to replace content of multiple files
lookupdir=src
filetype=*.java
#filetype=*.{html,php,htm}
find=some_email_ids1
replace=some_email_ids2
echo "Files to be Replaced"
grep -irl "$find" "$lookupdir" --include=$filetype
grep -irl "$find" "$lookupdir" --include=$filetype | xargs sed -i "s/$find/$replace/g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment