C
ccc31807
I've solved this problem, but I'm just curious as to how by betters
would approach this.
The file is a long file, so I have copied only the first seven records
below as an example. The file is from a table with nine fields, all of
which are named in the first nine lines. The key is a five digit
number beginning with either 91 or 92. For each record, sometimes all
fields are populated (like the first, 91709), but normally only the
first four are guaranteed to be populated while the remaining five may
or may not have values. Each datum occupies a line all to itself, and
the file does not contain record separators.
The requirement is to capture the first four fields and write to an
Excel readable file (CSV format).
My solution was pretty dirty and crude, but I'll share it later (and
take the hit for stupidity). My question is how others might approach
the problem. Below is the first seven records of the file and the
column header.
Thanks, CC.
-------------file below--------------------
Number
BandName
Grade
Branch
Instr
PipingInst
PInstDate
DrumInst
DrumInstDate
91709
87th Cleveland Pipe Band IV
PB4
Ohio Valley
y
Tyler Tagliafero, Great Lakes
01-Mar-09
Drew Donnelly, Great Lakes
01-Mar-09
91068
Adirondack Pipes & Drums
PB5
Northeast
n
91212
Alabama Pipes & Drums
PB4
Southern
n
91801
Albany Police P&D
PB5
Northeast
y
Dan Cole, Oran Mor
01-Mar-09
92033
American Celtic Pipe Band
PB5
Metro
n
91826
Anderson Pipe Band
PB5
Southwest
y
Victor Anderson, Westminster
01-Mar-09
Tim Vermillion, Westminster
01-Mar-09
91802
AOH Pipe & Drum Band
PB5
Northeast
n
would approach this.
The file is a long file, so I have copied only the first seven records
below as an example. The file is from a table with nine fields, all of
which are named in the first nine lines. The key is a five digit
number beginning with either 91 or 92. For each record, sometimes all
fields are populated (like the first, 91709), but normally only the
first four are guaranteed to be populated while the remaining five may
or may not have values. Each datum occupies a line all to itself, and
the file does not contain record separators.
The requirement is to capture the first four fields and write to an
Excel readable file (CSV format).
My solution was pretty dirty and crude, but I'll share it later (and
take the hit for stupidity). My question is how others might approach
the problem. Below is the first seven records of the file and the
column header.
Thanks, CC.
-------------file below--------------------
Number
BandName
Grade
Branch
Instr
PipingInst
PInstDate
DrumInst
DrumInstDate
91709
87th Cleveland Pipe Band IV
PB4
Ohio Valley
y
Tyler Tagliafero, Great Lakes
01-Mar-09
Drew Donnelly, Great Lakes
01-Mar-09
91068
Adirondack Pipes & Drums
PB5
Northeast
n
91212
Alabama Pipes & Drums
PB4
Southern
n
91801
Albany Police P&D
PB5
Northeast
y
Dan Cole, Oran Mor
01-Mar-09
92033
American Celtic Pipe Band
PB5
Metro
n
91826
Anderson Pipe Band
PB5
Southwest
y
Victor Anderson, Westminster
01-Mar-09
Tim Vermillion, Westminster
01-Mar-09
91802
AOH Pipe & Drum Band
PB5
Northeast
n