copy updater behavior to avoid report name/grade collisions. we might need duplicate...
[xtuple] / node-datasource / replsed.sh
1 #!/bin/bash
2
3 # example...
4 # sed -E "s/SC.(TableColumn|TableView)/EO.\1/g" $x > tmpfile
5
6 # expect 2 args, first is the one to find, second to replace
7 if [ $# -lt 2 ]
8   then
9     echo "You must pass 2 arguments. The first to 'find' and the second to 'replace'"
10     exit
11 fi
12
13 # assign the values for clarity
14 FIND=$1
15 REPLACE=$2
16 DEBUG=$3
17
18 echo "Searching for '$FIND' and will replace with '$REPLACE'"
19
20 echo "Starting to search and replace..."
21 for x in `find ./* -name '*.js'`
22   do
23     sed -E "s/$FIND/$REPLACE/g" $x > tmpfile
24     if [ "$DEBUG" ]
25       then
26         cat tmpfile
27       else
28         cat tmpfile > $x
29     fi
30   done
31 rm tmpfile
32 echo "done"