Extract number from .txt File & Rename
Posted: Thu Jul 24, 2008 3:01 pm
I need to extract a number from text files (HL7 v2.3 Healthcare files if anyone is familiar) and rename the file based on that number. Below is an example and the number I need to extract (AcctNum) is located where the 88888888 is. The number of text pipes will always be the same, the AcctNum will always be in the 19th position within the the line segment, which will always start with PID.
MSH|^~\&|SENDINGAPP|45|RECEIVINGAPP|HOSP|20080531210531||ADT^A03|Q123459789T123456789|P|2.3
EVN|A03|20080531210500|||ABC1234^DOE, RN^JANE^A^^^^^^CD:123456
PID|1|1234567|123456|12345|MOUSE^MINNY^J||12345678000000|F||H|1234 1ST AVE^^DISNEY WORLD^FL^99999||8005551234|8005551234|ENG|M|XYZ|88888888|123456789||||FLORIDA||0
I am not a programmer and will appreciate any help you can give me!
MSH|^~\&|SENDINGAPP|45|RECEIVINGAPP|HOSP|20080531210531||ADT^A03|Q123459789T123456789|P|2.3
EVN|A03|20080531210500|||ABC1234^DOE, RN^JANE^A^^^^^^CD:123456
PID|1|1234567|123456|12345|MOUSE^MINNY^J||12345678000000|F||H|1234 1ST AVE^^DISNEY WORLD^FL^99999||8005551234|8005551234|ENG|M|XYZ|88888888|123456789||||FLORIDA||0
I am not a programmer and will appreciate any help you can give me!