I have a CSV file containing comment text up to the title bar and data that I would like to read as a hash for further manipulation. The primary key has a hash combination of two data values. Like me?
- Search for title bar using the 'index' template
- Use caption for keys
- Read the rest of the file.
CSV example
Description information of source of file.
index,label,bit,desc,mnemonic
6,370,11,three,THRE
9,240,23,four,FOR
11,120,n/a,five,FIV
Example of a desired hash
( '37011' => { 'index' => '6', 'label' => '370', 'bit' => '11', 'desc' => 'three', 'mnemonic' => 'THRE'}, '24023' => {'index' => '9', 'label' => '240', 'bit' => '23', 'desc' => 'four', 'mnemonic' => 'FOR'}, '120n/a' => {'index' => '11', 'label' => '120', 'bit' => 'n/a', 'desc' => 'five', 'mnemonic' => 'FIV'} )
Elvis source
share