Every so often, the text contains this pattern:
Special Education Director
Jane Smith
PH: 123-457-7890
Fax: 234-567-8901
jane.smith@something.org
I need to harvest the fax numbers of special ed directors. So I used this code:
Code: Select all
put the milliseconds into tTime
repeat with i = 1 to the number of lines in field "RawData"
if line i of field "RawData" contains "Special Education Director" then
put line (i+3) of field "RawData" & return after field "Output"
add 3 to i
end if
end repeat
put "Done" into msg
put (the milliseconds - tTime) after msg
I know that I can improve the efficiency by not writing into the "Output" field each time but instead hold it in a variable, etc., but I doubt it will bring it down a whole lot. I was hoping that the whole thing should take not more than a few seconds (say 30). Am I being unreasonable?
My objective here is to improve my skills generally rather than solve this specific problem. Any advice is welcome.
Thanks,
Sri.
P.S.: I can upload the plain text raw data if you need it. It is public data of a state education directory.