#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
print(sys.argv[0])
print(sys.argv[1])
fr = open("C:\\Users\\Administrator\\Desktop\\file\\sql.txt")
fw = open("C:\\Users\\Administrator\\Desktop\\file\\sqlend.txt","w+")
a = 0
def start():
for line in fr.readlines():
a = a+1
if line.find("EXEC") != -1:
fw.write(line)
print(line,a)
def changeLine():
for line in fr.readlines():
while line.find(":") != -1:
startIndex = line.find(":")
index = startIndex
while line[index] != "|" and line[index] != " " and line[index] != ",":
index = index+1
line = line.replace(line[startIndex:index],"#{"+line[startIndex+1:index]+"}")
line = changeCml(line,startIndex,index+2)
print (line)
def changeCml(line,startIndex,endIndex):
print (line,startIndex,endIndex)
while line.find("_",startIndex,endIndex) != -1:
index = line.find("_",startIndex,endIndex)
lineLength = len(line);
print ("index:",index,lineLength)
line = line[0:index] + line[index+1].upper()+ line[index+2:lineLength]
endIndex = endIndex-1
return line
changeLine()
fw.close()
fr.close()
|