/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Mdc/DedxCalibAlg/DedxCalibAlg-00-01-15/share/sub/add_one_line.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import os
00004 import sys
00005 
00006 if(len(sys.argv)<2):
00007     print("example: add_one_line.py path [tag]")
00008     sys.exit()
00009 else:
00010     rawpath = str(sys.argv[1])
00011 
00012 if(len(sys.argv)>=3):
00013     tag = str(sys.argv[2])
00014 else:
00015     tag = ".txt"
00016 
00017 dirList=os.listdir(rawpath)
00018 for fname in dirList:
00019     if(fname.find(tag)>-1):
00020         fsave = open(rawpath + "/" + "temp.txt", "w")
00021         ftemp = open(rawpath + "/" + fname, "r")
00022         for ltemp in ftemp:
00023             if(ltemp.find("DedxCurSvc.BossVer")>-1):
00024                 fsave.write("DedxCurSvc.DbStatus=\"TEST\";\n")
00025             fsave.write(ltemp)
00026         fsave.close()
00027         ftemp.close()
00028         os.system("mv " + rawpath + "/temp.txt " + rawpath + "/" + fname)
00029 
00030 

Generated on Tue Nov 29 23:12:45 2016 for BOSS_7.0.2 by  doxygen 1.4.7