Skip to content

Instantly share code, notes, and snippets.

@hovsater
Created April 13, 2022 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hovsater/18e41e112a8f87623745239386776ac6 to your computer and use it in GitHub Desktop.
Save hovsater/18e41e112a8f87623745239386776ac6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
if [[ $# -lt 2 ]]; then
>&2 echo "usage: dte-replace <search> <replacement> [rg_args]"
exit 1
fi
rg "$1" --files-with-matches ${@:3} | xargs -n1 dte -c 'replace -c '$1' '$2'; save; quit'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment