On Fri, 26 May 2006 14:07:17 +1200 Nick Rout <[EMAIL PROTECTED]> wrote:
> > On Fri, 26 May 2006 12:04:48 +1200 > Hadley Rich wrote: > > > On Friday 26 May 2006 11:29, 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 > > > > Yeah, what language? > > > > echo $THAT_LINE | sed -e 's/.*load average: //' | cut -d ',' -f 1 > > > > a bit dirty but it works. > > > yes that works thanks. I think I am right in saying that the sed part > cuts out everything up to the words "load average:" and the cut part > then takes up until (but not including) the comma. > > > > -- > Nick Rout <[EMAIL PROTECTED]> > ...nearly. sed... substitute everything up to load average:[SPACE] with nothing. cut... return the first field ( of what's piped to it ), using ',' as the delimiter. Steve