From ca5454b37d55433f86e6f195202295db18ffe7c1 Mon Sep 17 00:00:00 2001 From: xHire Date: Sat, 25 Apr 2009 20:43:11 +0200 Subject: Added script for global replacement of some text --- scripts/replace.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/replace.sh (limited to 'scripts/replace.sh') 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/ -- cgit v1.2.3