Last active
February 24, 2022 15:09
-
-
Save torpedoallen/3c4d9832794922cdb88f to your computer and use it in GitHub Desktop.
git sub
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 | |
| # author: torpedoallen | |
| # usage: find and replace | |
| # how-to: put the file into your PATH like /usr/local/bin and make it executable. | |
| # reminders: the default sed command will no longer work fine with -i argument, please replace with gnu-sed | |
| if [ -z "$3" ]; then git grep -zl "$1" | xargs -0 sed -i "s/$1/$2/g"; else git grep -zl "$1" -- $3 | xargs -0 sed -i "s/$1/$2/g"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment