-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubstitui_snw.py
executable file
·53 lines (36 loc) · 1.63 KB
/
substitui_snw.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python
# encoding: utf-8
# Juliano Fischer Naves
# 23 de Outubro de 2013
import os,sys
def procura_no_arquivo(absolute_path):
list = []
f = open(absolute_path,'r')
lines = f.read().splitlines()
for line in lines:
new_line = line
#if "ProphetBlakcHoleMRouter" in line and "Scenario.name" not in line:
# new_line = line.replace("ProphetBlakcHoleMRouter","ProphetBlackHoleRouter")
if "SprayAndWaitRouter" in line and "Scenario.name" not in line and "Group1.router" in line:
new_line = new_line.replace("SprayAndWaitRouter","SprayAndWaitBlackHoleCM")
if "ProphetRouter" in line and "Scenario.name" not in line and "Group1.router" in line:
new_line = new_line.replace("ProphetRouter","ProphetBlackHoleCM")
if "EpidemicRouter" in line and "Scenario.name" not in line and "Group1.router" in line:
new_line = new_line.replace("EpidemicRouter","EpidemicBlackHoleCM")
if "semcontramedida" in line and "Scenario.name" not in line:
new_line = new_line.replace("semcontramedida","comcontramedida")
#if "Report.reportDir" in line:
# line = line.split('cenarioblackhole')
# new_line = line[0]+"cenarioblackhole/comcontramedida"+line[1]
list.append(new_line)
f = open(absolute_path,'w')
for l in list:
f.write(l)
f.write('\n')
f.flush()
f.close()
if __name__ == '__main__':
for root, dirs, files in os.walk('.'):
for file in files:
f = os.path.abspath(root) + "/" + file
procura_no_arquivo(os.path.abspath(f))