Hi Folks,
I could really use some help searching and converting (to array and/or vectors) a particular (but variable length) piece of text that appears in multiple text files.
Here's what a typical file looks like:
Start Time: 0.0 Time Elapsed: 600.032146474Initial Position: [-0.17248877882957458, 1.2094972133636475, -0.058800775557756424]Final Position: [4.5681076049804687, 1.6064592599868774, -4.8270955085754395]Distance Traveled: 312.929245491Relative Distance: 6.72382991569Initial Orientation: [-9.5176773071289062, 3.2656052112579346, 0.30539315938949585]Final Orientation: [49.040523529052734, -0.74396026134490967, -3.8589010238647461]Total Angular Movement: 40838.0665952Relative Change in Rotation: 58.5582008362Portals Breached:['sinkPortal', 82.382585985090287]['cactusPortal', 167.32241884094208]['bookcasePortal', 262.14078493216317]['cactusPortal', 269.48917152878369]['sinkPortal', 383.20171439386849]['bookcasePortal', 411.92835136867956]['wellPortal', 457.79343079916583]['sinkPortal', 466.6405778527718]['bookcasePortal', 494.15008779048731]['bookcasePortal', 569.05743781681747]Objects Visited:['home', 0.0088714487455838764]['left home', 20.152287930449265]['moon', 27.149798996799877]. . .
What I want to get from these files is just the information that you find between "Portals Breached" and "Objects Visited". The number of entries between those two bits of text varies from file to file. Here's what I want (e.g. two column vectors or one Nx2 array):
sinkPortal 82.382585985090287cactusPortal 167.32241884094208bookcasePortal 262.14078493216317cactusPortal 269.48917152878369sinkPortal 383.20171439386849bookcasePortal 411.92835136867956wellPortal 457.79343079916583sinkPortal 466.6405778527718bookcasePortal 494.15008779048731bookcasePortal 569.05743781681747
I should note that the number of lines in the text file before "Portals Breached" appears is standard across all the separate text files.
Thanks! Jon
Best Answer