Skip to content

Commit

Permalink
add script
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrandt1 committed Feb 6, 2018
1 parent 8a3c711 commit 5a501a8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions scripts/find_all_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
import re

def findfiles(path, regex):
regObj = re.compile(regex)
res = []
for root, dirs, fnames in os.walk(path):
for fname in fnames:
#print fname
if regObj.match(fname):
res.append(os.path.join(root, fname))
return res

def grep(filepath, regex):
regObj = re.compile(regex)
res = []
with open(filepath) as f:
#print f
for line in f:
#print line
if re.search('addModel',line):
m2 = re.findall(r'\"(.+?)\"',line)
#res.append(line)
if m2:
print m2[0], m2[1]
return res

headers = findfiles('.', r'.*cpp$')

#print headers

for filepath in headers:
res = grep( filepath, r'.*addModel.*"(.*)",')
#print res

0 comments on commit 5a501a8

Please sign in to comment.