Updated Finnish translation.
[freeciv.git] / scripts / replace
blob144c8d9429d329fb48148d9f4fb7c3b5111c7094
1 #!/bin/bash
3 # This is a script to replace one regular expression with another. Call
4 # it like `replace "foo bar" "bar foo"` to replace all "foo bar" text with
5 # "bar foo". By default it does replacement in *.[ch] files but this can
6 # be edited down below.
8 files=`find . -name "*.[ch]"`
9 #files=pango.diff
10 #files=`find . -type f -name "Makefile.am"`
11 #files=`find . -type f| grep -v CVS`
12 #files=`find . -name "*.ruleset"`
14 echo Replacing \"$1\" with \"$2\".
16 for file in $files; do
17 cat $file \
18 | sed "s/$1/$2/g" \
19 > $file.$$
21 cmp $file $file.$$ >/dev/null \
22 || (mv $file.$$ $file && echo " $file")
23 rm -f $file.$$
24 done