perl -pi -w -e 's/search/replace/g;' *
with multi-line strings:
import sys
search = 'search over
multiple lines'
replace = 'replace with
this string'
for i in sys.argv[1:]:
f = open(i, 'r')
s = f.read()
f.close()
f = open(i, 'w')
f.write(s.replace(search, replace))
f.close()
No comments:
Post a Comment