Skip to content

Instantly share code, notes, and snippets.

@jsgalan
Created February 13, 2012 20:17
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 jsgalan/c31ddca4955f722e1823 to your computer and use it in GitHub Desktop.
Save jsgalan/c31ddca4955f722e1823 to your computer and use it in GitHub Desktop.
Get information from a file based on a regexp and outputs to another file
import sys
import re
if __name__ == "__main__":
file=sys.argv[1] #get the pointer to file
rfp = open(file,"r") #file to be searched on
ofp = open('results.txt',"w") #open a file to print results
for lines in rfp:
a = re.findall(";",lines)
if (len(a) == 0):
print lines,
ofp.write(lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment