twoPhaseEulerFoam:frictionalStressModel/Schaeffer: Correct mut on processor boundaries
[OpenFOAM-1.7.x.git] / bin / tools / inlineReplace
blob5b0e64407c52ca3146c3855ba8bab3598bf50774
1 #!/bin/sh
3 # $0 string1 string2 file1 .. filen
5 if [ $# -lt 3 ]; then
6 echo "Usage: `basename $0` [-f] <string1> <string2> <file1> .. <filen>"
7 echo ""
8 echo "Replaces all occurrences of string1 by string2 in files."
9 echo "(replacement of sed -i on those systems that don't support it)"
10 exit 1
13 FROMSTRING=$1
14 shift
15 TOSTRING=$1
16 shift
18 for f in $*
20 if grep "$FROMSTRING" "$f" >/dev/null
21 then
22 cp "$f" "${f}_bak"
23 sed -e "s@$FROMSTRING@$TOSTRING@g" "${f}"_bak > "$f"
24 rm -f "${f}"_bak
25 #else
26 # echo "String $FROMSTRING not present in $f"
28 done