Created
May 4, 2015 18:20
-
-
Save autarch/cdb2c3b71a7c7f4c0a93 to your computer and use it in GitHub Desktop.
Bash script to rename a Perl package in a git repo (doesn't actually move the package though)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| if [[ $# == 2 ]]; then | |
| DIR=. | |
| OLD=$1 | |
| NEW=$2 | |
| else | |
| DIR=$1 | |
| OLD=$2 | |
| NEW=$3 | |
| fi | |
| git grep -l $OLD $DIR | xargs perl -pi -e 's/'$OLD'/'$NEW'/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment