29 lines
903 B
Python
Executable File
29 lines
903 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import csv
|
|
import sys
|
|
import re
|
|
|
|
ignore_regex=[
|
|
r"^\"URBAN REDEVELOPMENT AUTHORITY - PRIVATE RESIDENTIAL PROPERTY TRANSACTIONS WITH CAVEATS LODGED OR OPTIONS ISSUED\"$",
|
|
r"^(\d+) record(s) retrieved based on user-specific search criteria$"
|
|
]
|
|
ignore_re = re.compile("(?:" + "|".join(ignore_regex) + ")")
|
|
end_re = re.compile(r"^(\d+) record\(s\) retrieved based on user-specific search criteria$")
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) != 3:
|
|
print("Only two arguments")
|
|
exit(1)
|
|
|
|
# Open file
|
|
print("Opening \"%s\" and writing the result to \"%s\"" % (sys.argv[1], sys.argv[2]))
|
|
input = open(sys.argv[1], "r").readlines()
|
|
output = open(sys.argv[2], "w")
|
|
for line in input:
|
|
if end_re.search(line):
|
|
break
|
|
if len(line) == 1 or ignore_re.search(line):
|
|
continue
|
|
output.write(line)
|