Files
codezero/tools/replace_words
2009-06-10 16:32:04 +03:00

23 lines
359 B
Bash
Executable File

#!/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