Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 1 | import os |
| 2 | |
| 3 | def replace_code(old, new): |
| 4 | txt = os.popen("""grep "%s" ./*/*/*/*.js""" % old).read().split() |
| 5 | txt = [t.split(':')[0] for t in txt] |
| 6 | txt = list(set(filter(lambda t: t.startswith('./'), txt))) |
| 7 | for t in txt: |
| 8 | if new: |
| 9 | code = open(t,'r').read().replace(old, new) |
| 10 | open(t, 'w').write(code) |
| 11 | print "Replaced for %s" % t |
| 12 | else: |
| 13 | print 'Found in %s' % t |
| 14 | |
| 15 | if __name__=='__main__': |
nabinhait | 1bd56b1 | 2011-07-05 14:41:36 +0530 | [diff] [blame] | 16 | old = """cur_frm.cscript.get_tips(doc, cdt, cdn);""" |
nabinhait | c297df5 | 2011-07-05 10:54:05 +0530 | [diff] [blame] | 17 | new = " " |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 18 | replace_code(old, new) |
nabinhait | c297df5 | 2011-07-05 10:54:05 +0530 | [diff] [blame] | 19 | |