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: grep and remove lines | |
# how-to: put the file into your PATH like /usr/local/bin and make it executable. | |
if [ -z "$2" ]; then git grep -zl "$1" | xargs -0 sed -i "/$1/d"; else git grep -zl "$1" -- $2 | xargs -0 sed -i "/$1/d"; fi |
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 |