> 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
Easy. Given that you didn't specify the language, the default fallback is bash, which, short of a compiled language, is probably also the fastest: line=yourstring line="${line##*load average:}" line="${line##* }" load="${line%%,*}" echo "$load" The first two patterns could be combined, but as is, they allow for variable white space. You get the idea for other languages: kill everything until "load average", and after the first comma of what's left. Volker -- Volker Kuhlmann is list0570 with the domain in header http://volker.dnsalias.net/ Please do not CC list postings to me.