Need a python script to search specific keywords in a collection of sql files returning the index of where each keyword was found -


i'm extremely new python , wondering how take collection of files (sql), , using specific keywords, find line of code matched throughout files. notions, ideas or suggestions life savingly helpful.

kind regards

tiago m

solution

s = 'somestring' names = ['file1.sql', 'file2.sql'] n in names:       f = open(n)     lines = f.readlines()     i, l in enumerate(lines):         if s in l:             print 'line %d' % (i) 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -