shell - How to every read three lines into html table from var? -
i set var:
imgpath=$(find $pwd -depth -maxdepth 3 -name "cpu_u.gif" -o -name "cpu_s.gif" -o -name "*memory_free.gif" | sort -n)
every read 3 lines var html table.
i write script:
#!/bin/sh imgpath=$(find $pwd -depth -maxdepth 3 -name "*cpu_u*.gif" -o -name "*cpu_s*.gif" -o -name "*memory_free.gif" | sort -n) cat <<eof1>report.html <html> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td width="15%" bgcolor="#00ffff"><span class="style5">testcase</span></td> <td width="15%" bgcolor="#00ffff"><span class="style5">grinder component</span></td> <td width="15%" bgcolor="#00ffff"><span class="style5">grinder component</span></td> <td width="10%" bgcolor="#00ffff"><span class="style5">value</span></td> <td width="15%" bgcolor="#00ffff"><span class="style5">jvm arguments </span></td> <td width="25%" bgcolor="#00ffff"><span class="style5">value</span></td> <td width="10%" bgcolor="#00ffff"><span class="style5">os kernal </span></td> <td bgcolor="#00ffff"><span class="style5">value</span></td></tr> <tr><td rowspan="5"><span class="style9"></span></td> <td><span class="style10">runmode</span></td> <td><span class="style10">continuous</span></td> <td rowspan="5"><span class="style10">jvm.argument</span></td> <td rowspan="2"><span class="style10">hotspot:</span></td> <td><span class="style10">runmode</span></td> <td><span class="style10">1</span></td></tr> <tr><td><span class="style10">durationhour</span></td> <td><span class="style10">1</span></td>" <td><span class="style10">durationhour</span></td> <td><span class="style10">1</span></td></tr> <tr><td><span class="style10">processors</span></td> <td><span class="style10">1</span></td> <td rowspan="3"><span class="style10">jrockit:</span></td> <td><span class="style10">processors</span></td> <td><span class="style10">10</span></td></tr> <tr><td><span class="style10">threads</span></td> <td><span class="style10">10</span></td> <td><span class="style10">threads</span></td> <td><span class="style10">1000</span></td></tr> <tr><td><span class="style10">arraylength</span></td> <td><span class="style10">1000</span></td> <td><span class="style10">arraylength</span></td> <td><span class="style9"></span></td></tr></table> eof1 while read line; case $((i++ % 3)) in 3) echo -n "$s";; esac done<report.html cat <<eof2 >> report.html <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td rowspan="5"><span class="style9"><a href=\"$img\"><img src="$imgpath" /a></span></td></tr></table> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td rowspan="5"><span class="style9"><a href=\"$img\"><img src="$imgpath" /a></span></td></tr></table> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td rowspan="5"><span class="style9"><a href=\"$img\"><img src="$imgpath" /a></span></td></tr></table> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td rowspan="5"><span class="style9"><a href=\"$img\"><img src="$imgpath" /a></span></td></tr></table> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td rowspan="5"><span class="style9"><a href=\"$img\"><img src="$imgpath" /a></span></td></tr></table> <table width="1000" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#333333"> <tr><td rowspan="5"><span class="style9"><a href=\"$img\"><img src="$imgpath" /a></span></td></tr></table> </html> eof2
but insert lines.
thanks!
this here:
case $((i++ % 3)) in 3) echo -n "$s";; esac
does not want. i++ % 3
0, 1, or 2, never 3.
Comments
Post a Comment