-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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