0

I have a CSV and 2 file headers I want to change.

"h1","h2","h3","h4"
"d1","d2","d3","d4"

csv = CSV.read(file,headers:true)

How can I find, for example, "h3" and change it's name to "header3"?

Dreyfuzz
  • 486
  • 2
  • 13
  • this question may have been answered here? : `http://stackoverflow.com/questions/3717464/parse-csv-file-with-header-fields-as-attributes-for-each-row` – Shiyason Jan 19 '17 at 04:33

1 Answers1

0

I found an answer, and why this isn't a function in the CSV library; it can be done with File and gsub.

How to search file text for a pattern and replace it with a given value

Community
  • 1
  • 1
Dreyfuzz
  • 486
  • 2
  • 13