-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprintPrescales.py
47 lines (35 loc) · 924 Bytes
/
printPrescales.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
#!/usr/bin/python
#
import sys,string
FLAG="TRIGGER NAME"
def OpenFile(file_in,iodir):
""" file_in -- Input file name
iodir -- 'r' readonly 'r+' read+write """
try:
ifile=open(file_in, iodir)
# print "Opened file: ",file_in," iodir ",iodir
except:
print "Could not open file: ",file_in
sys.exit(1)
return ifile
if __name__ == "__main__":
narg=len(sys.argv)
if narg < 2 :
print usage.__doc__
sys.exit(1)
file1=sys.argv[1]
ifile=OpenFile(file1,'r')
contents = ifile.readlines()
ifile.close()
count=0
iline=-1
for line in contents:
iline=iline+1
l=line.strip()
# print l
indx=string.find(l,FLAG)
if (indx>-1): count=count+1
if (count == 2): break
prescaleLine=contents[iline+2]
xx=string.split(prescaleLine)
print xx[1],xx[3]