pavankiran56
Programmer
- Mar 11, 2013
- 1
HI all,
below is awk script im using to convert a csv file to HTML i want to passs multiple files as input to awk and get output in to multiple html files as output in one go is it possible ...
i know that awk can accept multiple inputs but out put is redirected to only one file but how can we get multiple outputfiles
below is awk script im using to convert a csv file to HTML i want to passs multiple files as input to awk and get output in to multiple html files as output in one go is it possible ...
i know that awk can accept multiple inputs but out put is redirected to only one file but how can we get multiple outputfiles
Code:
file=$1
awk -F, ' BEGIN {
print "<html><body>"
print "<table border=1>"
} NR == 1 {
print "<tr>"
for(i=1;i<=NF;i++){
print "<th><b><font face=\"verdana\"><font size=\"2\"><font color=\"Brown\">" $i"</font></b></th>"
}
print "</tr>"
} NR > 1 {
print "<tr>"
for(i=1;i<=NF;i++) {
print "<td><b><font face=\"verdana\"><font size=\"2\"><font color=\"Black\">" $i"</font></b></td>"
}
print "</tr>"
} END {
print "</table>"
print "</body></html>"
} ' $file >> $file.html