Converting html table data into multiple variables.

Hi,
Basically what I am trying to do is the following.

I have created a shell script to grab timetabling information from a website using curl then I crop out only the data I need which is a table based on the current date. It leaves me with a file that has the table I want plus a small amount of java script which I don't need.

The only thing I am interested in is the table which contains the timetable for that day.

I want to convert the html table into multiple variables so that I can later convert the data into either a text file or a rss file. The problem lies with the table depending on the day can have a different number of columns or rows.

How would I go about creating individual variables for each item in the table when the columns and rows change each day.

Thanks
dom

Example data helps.

Sorry about that

Attached is what I have cut from the html page

Monday
March 1 2010

<table width='100%' border='1' cellspacing='0' cellpadding='3'>        

<tr>
            
<th>Booking #</th>
<th>Client / UOS</th>
<th>Day</th>
<th>Times</th>
<th>Dates</th>
<th>Frequency</th>
<th>Capacity</th>
<th>Purpose</th>
<th>�</th>
</tr>
                        
<tr>
<td>
                                        
<a href='bookingDetails.jsp?tempViewSingle=true&bookingId=595897'>595897</a>
</td>
                                    
                                        
<td><a href="http://www.unix.com/ttLabel.jsp?academicYear=2010&sessionId=1&labelString=LAWS1022&campusId=1">LAWS1022</a></td>
                                        
<td>MON</td>
<td>10:00 - 12:00</td>
<td>1 Mar 10 - 12 Apr 10</td>
<td>Weekly</td>
<td>20</td>
<td>Seminar</td>
                    
<td>
<a href='booking.jsp?level2=Edit&bookingId=595897'>Edit</a>
                        
�</td>
                    
</tr>
                        
<tr>
<td>
<a href='bookingDetails.jsp?tempViewSingle=true&bookingId=595914'>595914</a>
</td>
                                        
                                        
<td><a href="http://www.unix.com/ttLabel.jsp?academicYear=2010&sessionId=1&labelString=LAWS1013&campusId=1">LAWS1013</a></td>
                                        
<td>MON</td>
<td>12:00 - 13:00</td>
<td>1 Mar 10 - 12 Apr 10</td>
<td>Weekly</td>                    
<td>20</td>
<td>Seminar</td>
<td>
                        
<a href='booking.jsp?level2=Edit&bookingId=595914'>Edit</a>
�</td>
                    
</tr>
                        
<tr>
<td>
                                        
<a href='bookingDetails.jsp?tempViewSingle=true&bookingId=595900'>595900</a>
</td>
                                        
<td><a href="http://www.unix.com/ttLabel.jsp?academicYear=2010&sessionId=1&labelString=LAWS1022&campusId=1">LAWS1022</a></td>
                                        
<td>MON</td>
<td>14:00 - 16:00</td>
<td>1 Mar 10 - 12 Apr 10</td>
<td>Weekly</td>                    
<td>20</td>
<td>Seminar</td>
<td>
<a href='booking.jsp?level2=Edit&bookingId=595900'>Edit</a>
�</td>
                    
</tr>
                        
</table>
<p>

Tuesday
March 2 2010

Basically each value between

<th> value </th><td> value </td>

is what I want to capture but sometimes the capacity column, frequency column or both columns are not always generated. So both the number of columns or number of rows can differ from day to day.