#!/bin/bash -e
#
# replace - quick search and replace

# find . -type f -exec sed -i '' s/$1/$2/g {} +
if [ "$#" -lt 2 ]; then
  echo "Usage: $(basename "$0") <old> <new> [path...]"
  exit 1
fi

rg --files -0 -- "${@:3}" \
  | xargs -0 sed --in-place --separate --follow-symlinks -E "s!$1!$2!g" --
