Skip to content

Instantly share code, notes, and snippets.

@hattmarris
Last active July 10, 2019 16:15
Show Gist options
  • Save hattmarris/c18e15d0ddc7528bfe896887f3690c0a to your computer and use it in GitHub Desktop.
Save hattmarris/c18e15d0ddc7528bfe896887f3690c0a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
case $# in
2) DIR=.;SEARCH=$1;REPLACE=$2;;
3) DIR=$1;SEARCH=$2;REPLACE=$3;;
esac
echo "searching for string in $DIR for *.jsx files: $SEARCH"
echo "replacing with string in *.jsx files: $REPLACE"
find $DIR -type f \( -iname \*.jsx -o -iname \*.js \) | xargs sed -i '' "s/$SEARCH/$REPLACE/g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment