Convert csv to HTML table
This will do the trick:
echo "<table>" ;
print_header=true
while read INPUT ; do
if $print_header;then
echo "<tr><th>$INPUT" | sed -e 's/:[^,]*\(,\|$\)/<\/th><th>/g'
print_header=false
fi
echo "<tr><td>${INPUT//,/</td><td>}</td></tr>" ;
done < Medical.csv ;
echo "</table>"
Explanation of the regex used is sed
:
:[^,]*(,|$)
This will match : 'participation.type',
and :'participation'\n
($
means end of input/line in regex).