How to parse a text file & collect a piece of each line automatically?
May 9, 2012 10:18 AM Subscribe
I need to go through text files, each containing hundreds of lines, and copy a specific part of each line, and then add all those parts together into one long line, each part separated by a comma. But how?
Basically, each file has hundreds of lines similar to these examples:
What I need to do is get the numbers AFTER VehicleID= and before the following &, and then present them in one long line with commas:
5322,3232,2323,5232 [and so on...]
I have a PC and a Mac at my disposal so either is fine for this. I was going to create an Automator workflow that would find & replace the beginning of each sentence (up to VehicleID=) with a blank/comma, and then find & replace again starting at &.... Unfortunately this doesn't work because the rest of the line is always unique.
I haven't done any programming since Turbo Pascal. I looked at Xcode but it would take longer to learn how to do this with Xcode than it would to go through every line in a text processor.
This seems like such a simple thing, though, so maybe someone can think of something I could try.