From: James Gray Date: 2009-06-23T08:14:09+09:00 Subject: Re: if column header contain regexp, delete column On Jun 22, 2009, at 5:30 PM, Paul Shapiro wrote: > James Gray wrote: >> On Jun 22, 2009, at 8:30 AM, Paul Shapiro wrote: >> >>>> James Edward Gray II >>> >>> I'm guessing it was incorrect to assume that the delete statement >>> would >>> write out to the file? How would I do that. It prints correctly. >> >> Yes, the delete() call deletes a column out of the in-memory table >> data structure. If you want to write the result to a file, you do it >> the same way you wrote it to the screen: >> >> open("new_data.csv", "w") do |csv| # create a file >> csv.puts table # write to that >> end >> >> Hope that helps. >> >> James Edward Gray II > > that works great, but is there a way so that it doesn't output with > all > of those underscores and the case change. Sure, change the table() call to something like: table = FCSV.table("data.csv", :return_headers => true) and the output writing code to something like: FCSV.open("new_data.csv", "w") do |csv| table.each do |row| csv << row end end Hope that helps. James Edward Gray II