Advertisement
svenhoefer

Untitled

Dec 25th, 2017
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # git-replace - Replace strings in git repositorys
  4.  
  5. usage() {
  6.     echo "git-replace <search> <replace> [<path>]"
  7. }
  8.  
  9. test "$1" == "--help"   && { usage; exit 0; }
  10. test -z "$1" -o -z "$2" && { usage; exit 1; }
  11.  
  12. git grep -l "$1" $3 | xargs sed -i "s|$1|$2|g"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement