On Mar 15, 2006, at 5:48 PM, Geoff wrote:

> Ok, obiously I'm doing something wrong again. I am new to both
> programming and to Ruby, so please excuse the low brow questions!
>
> I've now got this because I really want to take the result and output
> to a new file, but it does not work:
>
> require 'CSV'
>
> last = ""
> newFile = File.open("C:\\temp\\geoff\\filldown\\filldownNew.txt", "w 
> +")

Change the above to:

newFile = CSV.open(...)

> CSV.foreach("C:\\temp\\geoff\\filldown\\filldown.txt") do |row|
> 	if row[-1].empty?
> 		row[-1] = last
> 	else
> 		last = row[-1]
> 	end
> 	newFile << (p row)

And this to:

newFile << row

> end
>
> Ideas?

Also, just FYI, the Ruby naming convention for variables is  
like_this, not likeThis.

Hope that helps.

James Edward Gray II