Skip to content

Commit

Permalink
feat(scripts): Added simple script for replacing.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKJeff16 committed Jun 7, 2024
1 parent 72d81e8 commit 66d0890
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/global_replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

[[ $# -eq 0 ]] && exit 1

IFS=$'\n' FILES=($(find . -type f -regex '.*\.lua$' | cut -d '/' -f2-))

while [[ $# -gt 0 ]]; do
if ! [[ "$1" =~ ^s/.+/.*/g$ ]] ; then
shift
continue
fi

REGEX="$1"

for F in "${FILES[@]}"; do
sed -i "${REGEX}" "$F" || break
done

shift
done

exit 0

0 comments on commit 66d0890

Please sign in to comment.