add the rename script which i have used for refactoring
authorHannes Gredler <hannes@gredler.at>
Wed, 27 May 2009 07:30:11 +0000 (09:30 +0200)
committerHannes Gredler <hannes@gredler.at>
Wed, 27 May 2009 07:30:11 +0000 (09:30 +0200)
scripts/rename.sh [new file with mode: 0755]

diff --git a/scripts/rename.sh b/scripts/rename.sh
new file mode 100755 (executable)
index 0000000..6fe8b51
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+# 
+# Walk a source tree and search/replace all occurences of a given term.
+# The script comes handy for refactoring projects.
+for i in $(find . -type f -name "*.c" -o -name "*.h"); do sed 's/search-term/replace-term/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done