Last active
July 6, 2024 01:03
-
-
Save clarkritchie/4e1e365085675995d9726d70cd87b9a3 to your computer and use it in GitHub Desktop.
Silver Searcher Search and Replace
This file contains 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
# function agr { ag -0 -l "$1" | xargs -0 perl -pi.bak -e "s/$1/$2/g"; } | |
function agr() { [ -z "$1" ] && { echo "Error: First argument is empty. Exiting gracefully."; return 1; }; ag -0 -l "$1" | xargs -0 perl -pi.bak -e "s/$1/$2/g"; } | |
export -f agr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment