I have a Medical.csv file with rows of following format,
field: 'participation.type', displayName: 'program_type', type: 'String',path:'participation'
field: 'participation.program', displayName: 'program_name', type: 'String',path:'participation'
I want to write a bash script to convert it to HTML table with field, displayName and type as headers dynamically.
The Csv2HtmlConverter.sh (Inspired by answer at Convert csv to html table usingConvert csv to html table using) is
echo "<table>" ;
while read INPUT ; do
echo "<tr><td>${INPUT//,/</td><td>}</td></tr>" ;
done < Medical.csv ;
echo "</table>"
The result for above script is as below which is fine to some extent but I want to add <th>field</th>, <th>displayName</th> dynamically.
<table>
<tr><td>field: 'participation.type'</td><td> displayName: 'program_type'</td><td> type: 'String'</td><td>path:'participation'</td></tr>
<tr><td>field: 'participation.program'</td><td> displayName: 'program_name'</td><td> type: 'String'</td><td>path:'participation'</td></tr>
</table>