# Parsing and ovewriting a comma delimated file

**URL:** <https://www.ruby-forum.com/t/parsing-and-ovewriting-a-comma-delimated-file/74173>\
**Category:** Rails\
**Created:** [November 1, 2006, 12:08am UTC](https://www.ruby-forum.com/t/parsing-and-ovewriting-a-comma-delimated-file/74173 "2006-11-01T00:08:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubynewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Post date:** [November 1, 2006, 12:08am UTC](https://www.ruby-forum.com/t/parsing-and-ovewriting-a-comma-delimated-file/74173/1 "2006-11-01T00:08:02Z")

</div>

Hi,

I am a newbie please be kind enough to help me…

I have XML like config file which looks like below.

Code:

 Test Save False

I have a parser which will parse and give me the values out of the above  
mentioned XML like config file

What I need help is in creating function which will use that information  
to overwrite the information below shown file

Code:

\_ErrorEnabled,\_SupplementalJobAttributes#,true,

So for example it should overwrite the information in above mention line  
as

Code:

\_ErrorEnabled,\_SupplementalJobAttributes#,false,

Please note there are many lines of information like that I need to  
overwrite

any help would be great as I have no idea to do this in a optimal  
fashion.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![rubynewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Post date:** [November 1, 2006, 3:37am UTC](https://www.ruby-forum.com/t/parsing-and-ovewriting-a-comma-delimated-file/74173/2 "2006-11-01T03:37:07Z")

</div>

rubynewbie wrote:

> Hi,
> 
> I am a newbie please be kind enough to help me…
> 
> I have XML like config file which looks like below.

…

> What I need help is in creating function which will use that information  
> to overwrite the information below shown file
> 
> Code:
> 
> \_ErrorEnabled,\_SupplementalJobAttributes#,true,
> 
> So for example it should overwrite the information in above mention line  
> as  
> …
> 
> any help would be great as I have no idea to do this in a optimal  
> fashion.
> 
> Thanks in advance

I’m still a bit of a newbie myself. I’ve found that I get much better  
response to a question like:  
“I wrote the following code to do so and so, and I don’t understand why  
it doesn’t work…”

or

“Here is my code to do so and so, can anyone recommend a better way or  
suggest some optimizations?”

rather than

“please write my code for me.”

BTW, do you have the “pickaxe ruby book” by Dave T.? I strongly  
recommend spending some time with that before trying to do any big Ruby  
stuff in your Rails app. You need to become well versed in regular  
expressions and gsub and the file related bits in Ruby to tackle the job  
you describe here. Also look into the Rexml library described in the  
above book.

best,  
jp

---

<div class="post-metadata">

**Author:** ![rubynewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rubynewbie](https://www.ruby-forum.com/u/rubynewbie)\
**Post date:** [November 7, 2006, 10:50am UTC](https://www.ruby-forum.com/t/parsing-and-ovewriting-a-comma-delimated-file/74173/3 "2006-11-07T10:50:36Z")

</div>

This looks like a strictly Ruby question. I think you’ll get more  
response  
at comp.lang.ruby,  
[http://groups.google.com/group/comp.lang.ruby](http://groups.google.com/group/comp.lang.ruby)

hth,  
Bill
