On May 26, 2006, at 11:29 AM, Nick Rout wrote:

given this string (all one line):

Tracker Load: (9 %)<table class=main border=0 width=400><tr><td style='padding: 0px; background-image: url(pic/loadbarbg.gif); background-repeat: repeat-x'><img height=15 width=36 src="/pic/ loadbargreen.gif" alt='9%'></td></tr></table>18:25:15 up 2 days, 23:44, 1 user, load average: 18.73, 20.96, 27.06<br></td></tr></ table>

what is the best way to parse out the first load average figure, ie in
this case 18.73

The best way will depend on what you're using, and how likely that string is to change.

Just off the top of my head, you could find the index of the substring "load average" and go from there, or maybe throw everything into a CSV parser to get the string " load average: 18.73", which wouldn't need much manipulation to convert to a numeric data type.

- Dave

Reply via email to