Skip to content

Instantly share code, notes, and snippets.

@fcrespo82
Created February 9, 2015 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcrespo82/76471af04b98e98fdadd to your computer and use it in GitHub Desktop.
Save fcrespo82/76471af04b98e98fdadd to your computer and use it in GitHub Desktop.
Script to count quotation marks in jsp
import os
import re
with open("/home/fxcrespo/workspaces/workspace_siga/count.log", "w") as thelog:
for path, dirs, files in os.walk("/home/fxcrespo/workspaces/workspace_siga"):
for thefile in files:
thepath = os.path.join(path, thefile)
if thepath.endswith("jsp"):
thecount = len(re.findall("\"", "".join(open(thepath).readlines())))
if thecount > 0 and (thecount % 2 != 0):
print(thepath, thecount)
thelog.write(thepath + " - " + str(thecount) + "\n")
break
#if len(files) > 120: break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment