summaryrefslogtreecommitdiffstats
path: root/replace.py
blob: efa8b54aab53d10403d7ef3b2ffcff9fdb616a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python

import sys

string_from = sys.argv[1]
string_to = sys.argv[2]
files = sys.argv[3:]

for filename in files:
    f = open(filename, "r+")
    data = f.read()
    data = data.replace(string_from, string_to)
    f.seek(0)
    f.truncate()
    f.write(data)
    f.close()