summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorxHire <xhire@tuxportal.cz>2009-04-25 20:43:11 +0200
committerxHire <xhire@tuxportal.cz>2009-04-25 20:43:11 +0200
commitca5454b37d55433f86e6f195202295db18ffe7c1 (patch)
treee51be40d4af0a61a40f3e1c07ee82ce806ed9fba /scripts
parent5ed6b5cc5a223117c3693f9a7ec57125273f6bc5 (diff)
Added script for global replacement of some text
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/replace.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/replace.sh b/scripts/replace.sh
new file mode 100755
index 0000000..7912c72
--- /dev/null
+++ b/scripts/replace.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# '@' - this char is prohibited to use
+oldtext="$1"
+newtext="$2"
+
+GoThroughDir() {
+ for D in $1*; do
+ if [ -d $D ] && [ "$D" == "./.git" ]; then
+ continue
+ elif [ -d $D ] && [ "$D" == "./build" ]; then
+ continue
+ elif [ -d $D ]; then
+ GoThroughDir $D/
+ elif [ "$D" == "$0" ]; then
+ continue
+ else
+ sed -i -e "s@$oldtext@$newtext@" $D
+ fi
+ done
+}
+
+GoThroughDir ./
+
+grep -iHr "$oldtext" ./ | grep -v .git/