-
-
Save luckman212/ab07a0846c3bfedf077c1cf9930f4610 to your computer and use it in GitHub Desktop.
rgr: quick in-place search and replace using ripgrep + gsed
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
#!/usr/bin/env bash | |
case $1 in | |
-h|--help|'') echo "usage: ${0##*/} <old> <new>"; exit;; | |
esac | |
export old="\b$1\b" | |
export new=$2 | |
rg --files-with-matches -0 "${old}" | | |
xargs -0 -I % gsed -E -i "s/${old}/${new}/g" -- % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment