Skip to content

Instantly share code, notes, and snippets.

@autarch
Created May 4, 2015 18:20
Show Gist options
  • Select an option

  • Save autarch/cdb2c3b71a7c7f4c0a93 to your computer and use it in GitHub Desktop.

Select an option

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)
#!/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