summaryrefslogtreecommitdiff
path: root/replace.sh
diff options
context:
space:
mode:
authorluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2020-07-04 18:14:40 -0400
committerluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2020-07-04 18:14:40 -0400
commitd7df6bf6e3b6066bef0bd0602b0b9c2d036f100a (patch)
tree84f7564fdc72867f44e9c5acf6b1dae78b5f13b6 /replace.sh
parentaecf2dbf6e26469cc40ab2c3aec155aecba7091b (diff)
Get rid of manual sym defines in sym_ewram.txt and ld_script_modern.txt
Diffstat (limited to 'replace.sh')
-rw-r--r--replace.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/replace.sh b/replace.sh
new file mode 100644
index 000000000..8ec32d944
--- /dev/null
+++ b/replace.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# $1: phrase to find
+# $2: phrase to replace $1
+if [ "$1" = "" -o "$2" = "" ]; then
+ echo "Usage: replace.sh [PHRASE TO FIND] [PHRASE TO REPLACE PHRASE TO FIND]"
+ exit 0
+fi
+
+sed -i 's/\<'"$1"'\>/'"$2"'/' $(grep -lwr --include="*.s" --include="*.h" --include="*.c" --include="*.inc" --include="*.json" --include="*.txt" --exclude-dir="tools" --exclude-dir=".git" --exclude-dir="build" --exclude-dir="berry_fix/build" --exclude-dir="berry_fix/payload/build" --exclude-dir=".travis" "$1")