Hi there.
I'm dealing with cleaning relatively large (30ish lines) blocks of text. Here's an excerpt:
PID|1||06225401^^^PA0^MR||PATIENT^FAKE R|||F
PV1|1|I|||||025631^DoctorZ^^^^^^^PA0^^^^DRH|DRH||||...
ORC|RE||CYT-09-06645^AP||||||200912110333|INTERFACE07
OBR|1||CYT09-06645|8104^^L|||20090602|||||||200906030000[conditio...
OBX|1|TX|8104|1|SOURCE OF SPECIMEN:[source]||||||F|||200912110333|CYT ...
I currently have a script that takes out illegal characters or terms. Here's an example.
infile = open(thisFile,'r')
m = infile.read()
#remove junk headers
m = m.replace("4þPATHþ", "")
m = m.replace("10þALLþ", "")
My goal is to modify this script so that I can add 4 digits to the end of one of the fields. In specific, the date field ("20090602") in the OBR line. The finished script will be able to work with any file that follows this same format. Is this possible with the way I currently handle the file input or do I have to use some different logic?