Forum: Ruby help regarding extracting a particular value in a file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B4b238a78cd9effacc1b6a8c15d3a5bb?d=identicon&s=25 Tanushree Bhoi (Guest)
on 2006-05-26 08:22
(Received via mailing list)
Hi all ,
I am new to ruby.I need to retrieve values from a file
in my ruby script.That file contains different nos of rows..
and in single row i have many parameters which are
separated by comma.How can i retrieve a particular parameter
value from a file.can u plz help?
example-
my file contains data like

product1,product2,product3,....etc
comp1,comp2,comp3....etc..

If i want to retrieve product2 how can i do it.Please help me.Now i am
doing
it
by putting only single value in a row.
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2006-05-26 10:16
(Received via mailing list)
2006/5/26, Tanushree Bhoi <tanushree.bhoi@gmail.com>:
> comp1,comp2,comp3....etc..
>
> If i want to retrieve product2 how can i do it.Please help me.Now i am doing
> it
> by putting only single value in a row.

You can use CSV for this:

http://ruby-doc.org/stdlib/libdoc/csv/rdoc/index.html

Kind regards

robert
This topic is locked and can not be replied to.