From 6de090a365cf80f83d3700b0cea1b13547e55fb3 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Wed, 10 Jun 2009 16:32:04 +0300 Subject: [PATCH] Added word replace tool --- tools/replace_words | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/replace_words diff --git a/tools/replace_words b/tools/replace_words new file mode 100755 index 0000000..3cbfae4 --- /dev/null +++ b/tools/replace_words @@ -0,0 +1,22 @@ +#!/bin/bash + +original=(a b c d) +replacement=(w x y z) + +# Test that we have both arguments +if [ -z "$1" ]; then + echo Usage: replace_words ORIGINAL REPLACEMENT + exit +fi + +for ((i=0;i<1;i++)); +do + + orig=${original[$i]} + repl=${replacement[$i]} + echo $orig to $repl + for filename in `find $1 -name '*.[ch]'` + do + sed -i -e "s/$orig/$repl/g" $filename + done +done