From: Nuralanur@... Date: 2006-05-26T17:27:07+09:00 Subject: Re: help regarding extracting a particular value in a file -------------------------------1148632012 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Assuming that your data is in a file "data_to_split.txt" in the same directory, you can do this: file_name="data_to_split.txt" data_array=IO.readlines(file_name) # reads content of file into an Array ( each entry = one line) only_second_entries=[] data_array.each{|line| only_second_entries<<(line.split(',')[1]) # note that indices start at 0 in Ruby } p 'only second entries contains' p only_second_entries If you have more complicated patterns that separate your data than just a comma, you can also use split in conjunction with "regular expressions". only_second_entries<<(line.split(/,/)[1]) # note that indices start at 0 in Ruby These "regular expressions" allow to search for things like "a comma and then two small letters, followed by at least three numbers and then anything but "A"", so there is room for arbitrary complexity ... Regular expressions are explained in detail here: _http://www.regular-expressions.info/_ (http://www.regular-expressions.info/) Best regards, Axel -------------------------------1148632012--