Hi there! I have a very long CSV file that is really the combination of multiple tables of data where each table is delineated by a START tag and an END tag. The two tables I am concerned with are called “Levels” and “Targets”. So the file looks like this (with example column headers and data in italics):
START_LEVELS
LEVELS, TABLE, COLUMN, HEADERS
1,1,1,1
2,2,2,2
3,3,3,3
END_LEVELS
START_TARGETS
TARGETS, TABLE, COLUMN, HEADERS, EXAMPLE
4,4,4,4,4
5,5,5,5,5
6,6,6,6,6
7,7,7,7,7
END_TARGETS
I am trying to find a way to programmatically split this file up into multiple individual files with one new smaller file per table. So there would be one new file called “Levels.csv” that contained this:
LEVELS, TABLE, COLUMN, HEADERS
1,1,1,1
2,2,2,2
3,3,3,3
And another new file called “Targets.csv” that contained this:
TARGETS, TABLE, COLUMN, HEADERS, EXAMPLE
4,4,4,4,4
5,5,5,5,5
6,6,6,6,6
7,7,7,7,7
Can I do this with pure AppleScript? Do I need to use AppleScript to control a text editor like TextWrangler? Any guidance would be much appreciated.