Extracting data to a table.

More than one way to skin a cat.

# just a thought
IFS=’%’
line=” [173]Virginia                          3-5 5-7 310 289 5-2 0-5 Lost 1″

Screenshot - 12032014 - 08:56:43 AM

a=`echo $line | cut -c8-28`
b=`echo $line | cut -c29-31`
c=`echo $line | cut -c33-35`
d=`echo $line | cut -c38-40`
e=`echo $line | cut -c42-44`
f=`echo $line | cut -c46-48`
g=`echo $line | cut -c51-53`
h=`echo $line | cut -c56-61`

echo “<html>”> somefile.html
echo “<body>”>> somefile.html
echo “<table border=1>”>> somefile.html
 echo "<tr><td>School</td><td>W-L</td><td>W-L</td><td>PF</td><td>PA</td><td>Home</td><td>Away</td><td>Current streak</td></tr>" >> somefile.html
echo “<tr><td>$a</td><td>$b</td><td>$c</td><td>$d</td><td>$e</td> \ <td>$f</td><td>$g</td><td>$h</td></tr>” >> somefile.html
echo “</table>”>> somefile.html
echo “</body>”>> somefile.html
echo “</html>”>> somefile.html

#————————————–

chmod +x testithtml.sh
./ testithtml.sh
links2 -dump somefile.html


Firefox


Somefile.html

<html>
<body>
<table border=1>
<tr><td>School</td><td>W-L</td><td>W-L</td><td>PF</td><td>PA</td><td>Home</td><td>Away</td><td>Current streak</td></tr>
<tr><td>Virginia             </td><td>3-5</td><td>5-7</td><td>310</td><td>289</td><td>5-2</td><td>0-5</td><td>Lost 1</td></tr>
</table>
</body>
</html>

Comments

Popular posts from this blog

Guiless?

MSOffice vs Libreoffice

Raspberry pi zero.