I have been trying to read a large file and writing to another file at the same time after processing the data from the input file, the file is pretty huge around 4-8 GB, is there a way to parallelise the process to save the time
The original program is:
with open(infile,"r") as filein:
with open(writefile,"w") as filewrite:
with open(errorfile,"w") as fileerror:
line=filein.readline()
count=0
filewrite.write("Time,Request,IP,MAC\n")
while line:
count+=1
line=filein.readline()
#print "{}: {}".format(count,line.strip()) testing content
if requestp.search(line):
filewrite.write(line.strip()[:15]+",")
filewrite.write(requestp.search(line).group()+",")
if IP.search(line):
filewrite.write(IP.search(line).group())
filewrite.write(",")
if MACp.search(line):
filewrite.write(MACp.search(line).group())
filewrite.write("\n")
else:
fileerror.write(line)
But this takes too much time to process such a file and I have 100's of such files, I've tried using Ipyparellel to parallilise the code but have not met with success yet, is there a way to do this.