Read in hierarchy file then export in comma delimited format

Hi. I am a beginner to ruby programming. I would like to create a
program that reads in a hierarchy file having table, column and data.
The file
would be read and exported into a text file delimited by commas. I have
pasted an example of the file that would be read in. Thanks in advance.
Michelle

To explain, the indents: When 0 indents then the record is a Table, when
3 indents then a Column, when 6 indents then a Value.

The text file should be comma delimited by table, column and value.

Example row data that I would like the new text file to look like:

TABLE, COLUMN, VALUE
DOC, BEGIN_OR_END, BEGIN
DOC, BEGIN_OR_END, END
DOC, PROPOSED OR EXISTING, PROPOSED

This is the file contents and layout of the current file:

“DOC”, point, “DEPTH OF COVER”, 5, seconds, 1, Code
“BEGIN_OR_END”, menu, normal, “BEGIN_OR_END”, normal
“BEGIN”
“END”
“PROPOSED OR EXISTING”, menu, normal, “PROPOSED OR EXISTING”, normal
“PROPOSED”
“EXISTING”
“COVER”, numeric, 0, 0, 10000, 0, normal, “COVER”, normal
“COMMENTS”, text, 30, normal, “COMMENTS”, normal

“EROSION_CONTROL”, point, “EROSION CONTROL”, 5, seconds, 1, Code
“IS THIS ON THE CL?”, menu, required, “IS THIS ON THE CL?”, required
“YES”
“NO”
“BEGIN_OR_END”, menu, normal, “BEGIN_OR_END”, normal
“BEGIN”
“END”
“TYPE”, menu, required, “TYPE”, normal
“BREAKER”
“CLAY”
“DIRT”
“FOAM”
“MATERIAL”, menu, normal, “MATERIAL”, normal
“RIPRAP”
“SACKCRETE”
“SAND BAG”
“TERRACE”
“UNKNOWN”
“COMMENTS”, text, 30, normal, “COMMENTS”, normal

On Sep 6, 2012, at 12:46 , Michelle C. [email protected] wrote:

Hi. I am a beginner to ruby programming. I would like to create a
program that reads in a hierarchy file having table, column and data.
The file
would be read and exported into a text file delimited by commas. I have
pasted an example of the file that would be read in. Thanks in advance.

This is not the type of task that a beginner in ruby takes on. That
implies to me that you’re either cheating on homework or, more likely,
trying to get us to do your job (for free, no less). We find this type
of behavior unethical and won’t help you with this. If you have a
question about ruby, fine. Ask a question about ruby. We’d love to help
you learn this fine language… But we’re not here as free consultants.

Ryan D. wrote in post #1074979:

On Sep 6, 2012, at 12:46 , Michelle C. [email protected] wrote:

Hi. I am a beginner to ruby programming. I would like to create a
program that reads in a hierarchy file having table, column and data.
The file
would be read and exported into a text file delimited by commas. I have
pasted an example of the file that would be read in. Thanks in advance.

This is not the type of task that a beginner in ruby takes on. That
implies to me that you’re either cheating on homework or, more likely,
trying to get us to do your job (for free, no less). We find this type
of behavior unethical and won’t help you with this. If you have a
question about ruby, fine. Ask a question about ruby. We’d love to help
you learn this fine language… But we’re not here as free consultants.

I am a beginner and not a programmer and needed to simply transpose a
small data file. Your reply is in poor taste. While you were busy
attempting to use your special ESP powers on a new user from a ruby
forum, I was able to download a gem that helped me to complete the task.

Good luck with your social skills - it is obvious you need help.

-Michelle

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs