Re: parsing

2006-05-27 Thread Keith McGavin
On Sat, May 27, Volker Kuhlmann wrote: > I don't think that awk allows a regex for field separation. A Unix reference manual mentions that (original) awk uses Space or Tab as the default field separator and a single character if the option -Fc is used. -- keith.

Re: parsing

2006-05-27 Thread Keith McGavin
On Sat, May 27, Hadley Rich wrote: > I must play with awk some more. explaination of some syntax in the awk/gawk manual is not always obvious but the awk/gawk gurus on news://comp.lang.awk will clarify how it is used if google fails. An active newgroup. --- keith

Re: parsing

2006-05-26 Thread Volker Kuhlmann
> 'awk' accepts an "array" of field separators -F'[fsfsfs]' between square > brackets so the required field $12 can be printed out. Not mentioned in the > manual. In the interest of portability awareness, let me be anally correct. I don't think that awk allows a regex for field separation. Howev

Re: parsing

2006-05-26 Thread Hadley Rich
On Saturday 27 May 2006 16:07, Keith McGavin wrote: > 'awk' accepts an "array" of field separators -F'[fsfsfs]' between square > brackets so the required field $12 can be printed out. Not mentioned in the > manual. > > echo $THAT_LINE | awk -F'[,:]' '{print $12}' Nice, I would say that's a winner.

Re: parsing

2006-05-26 Thread Keith McGavin
On Fri, May 26, 2006 at 11:29:54AM, Nick Rout wrote: > what is the best way to parse out the first load average figure, ie in > this case 18.73 'awk' accepts an "array" of field separators -F'[fsfsfs]' between square brackets so the required field $12 can be printed out. Not mentioned in the man

Re: parsing

2006-05-25 Thread Steve Holdoway
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 %) > > style='padding: 0px; background-imag

Re: parsing

2006-05-25 Thread Christopher Sawtell
On Friday 26 May 2006 14:07, Nick Rout wrote: > 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. Correct! -- CS

Re: parsing

2006-05-25 Thread Nick Rout
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 %) > style='padding: 0px; background-image: url(pic/loadbarbg.gif); > > background-repeat: repeat-x'> > src="/pic/loadbargreen.gif"

Re: parsing

2006-05-25 Thread Andrew Errington
> what is the best way to parse out the first load average figure, ie in > this case 18.73 The best way is to get someone else to do it for you and guarantee it will work. In Python (if foo is your string): load_average= float(foo.split('load average: ')[1].split(',')[0]) But it depends what l

Re: parsing

2006-05-25 Thread Volker Kuhlmann
> given this string (all one line): > > Tracker Load: (9 %) style='padding: 0px; background-image: url(pic/loadbarbg.gif); > background-repeat: repeat-x'> src="/pic/loadbargreen.gif" alt='9%'>18:25:15 up 2 days, > 23:44, 1 user, load average: 18.73, 20.96, 27.06 > > what is the best way to p

Re: parsing

2006-05-25 Thread David Mann
On May 26, 2006, at 11:29 AM, Nick Rout wrote: given this string (all one line): Tracker Load: (9 %)style='padding: 0px; background-image: url(pic/loadbarbg.gif); background-repeat: repeat-x'>18:25:15 up 2 days, 23:44, 1 user, load average: 18.73, 20.96, 27.06table> what is the best wa

Re: parsing

2006-05-25 Thread Hadley Rich
On Friday 26 May 2006 11:29, Nick Rout wrote: > given this string (all one line): > > Tracker Load: (9 %) style='padding: 0px; background-image: url(pic/loadbarbg.gif); > background-repeat: repeat-x'> src="/pic/loadbargreen.gif" alt='9%'>18:25:15 up 2 days, > 23:44, 1 user, load average: 18.73,

Re: parsing

2006-05-25 Thread Carl Cerecke
Using which language? Also, does anyone else find it odd that the line has one and 2 s? Is there another further up? Cheers, Carl. On 26/05/06, Nick Rout <[EMAIL PROTECTED]> wrote: given this string (all one line): Tracker Load: (9 %)18:25:15 up 2 days, 23:44, 1 user, load average: 18.7

parsing

2006-05-25 Thread Nick Rout
given this string (all one line): Tracker Load: (9 %)18:25:15 up 2 days, 23:44, 1 user, load average: 18.73, 20.96, 27.06 what is the best way to parse out the first load average figure, ie in this case 18.73 -- Nick Rout <[EMAIL PROTECTED]>

Re: Parsing Mail log files

2005-10-27 Thread Daniel
Jamie Dobbs wrote: I am trying to parse my mail log files to find out the number of messages received per day and the total size of the messages received. The format of the log files is: From x Fri Oct 28 14:25:12 2005 Subject: FW: Emailing: super_cop_1_.wmv Folder: ~/Maildir/new/1130

Parsing Mail log files

2005-10-27 Thread Jamie Dobbs
I am trying to parse my mail log files to find out the number of messages received per day and the total size of the messages received. The format of the log files is: >From x Fri Oct 28 14:25:12 2005 Subject: FW: Emailing: super_cop_1_.wmv Folder: ~/Maildir/new/1130462726.5627_0.xxx

Re: parsing

2002-04-04 Thread Jim Cheetham
On Fri, Apr 05, 2002 at 05:03:24PM +1200, Wayne Rooney wrote: > From: Nick Rout <[EMAIL PROTECTED]> > >I have a string like postfix/smtpd[25532]: I want to cut it off at the > >[ so I end up with postfix/smtpd > > > For a fixed length string try > > echo postfix/smtpd[25532] | cut -c 1-13 Actu

Re: parsing

2002-04-04 Thread Wayne Rooney
-Original Message- From: Nick Rout <[EMAIL PROTECTED]> To: CLUG <[EMAIL PROTECTED]> Date: Friday, April 05, 2002 4:39 PM Subject: parsing >I have a string like postfix/smtpd[25532]: I want to cut it off at the >[ so I end up with postfix/smtpd > >how do

RE: parsing

2002-04-04 Thread Guy Steven
what is wrong with sed 's/\[.*\]//g' textfile -Original Message- From: Jeremy Bertenshaw [mailto:[EMAIL PROTECTED]] Sent: Friday, 5 April 2002 4:55 p.m. To: Nick Rout; CLUG Subject: Re: parsing cat textfile | sed 's/\[.*\]//g' :-) jeremyb. > From: Nick

Re: parsing

2002-04-04 Thread Volker Kuhlmann
> I have a string like postfix/smtpd[25532]: I want to cut it off at the > [ so I end up with postfix/smtpd sed 's/\[.*$//'(dump everything after first [ on line) Volker -- Volker Kuhlmann, list0570 at paradise dot net dot nz http://volker.orcon.net.nz/ Please do not CC list

Re: Re: parsing

2002-04-04 Thread Jeremy Bertenshaw
Or echo the string etc.. ;-) > From: Jeremy Bertenshaw <[EMAIL PROTECTED]> > Date: 2002/04/05 Fri PM 04:55:18 GMT+12:00 > To: Nick Rout <[EMAIL PROTECTED]>, CLUG <[EMAIL PROTECTED]> > Subject: Re: parsing > > cat textfile | sed 's/\[.*\]//g'

Re: parsing

2002-04-04 Thread Jeremy Bertenshaw
cat textfile | sed 's/\[.*\]//g' :-) jeremyb. > From: Nick Rout <[EMAIL PROTECTED]> > Date: 2002/04/05 Fri PM 04:39:28 GMT+12:00 > To: CLUG <[EMAIL PROTECTED]> > Subject: parsing > > I have a string like postfix/smtpd[25532]: I want to cut it off a

parsing

2002-04-04 Thread Nick Rout
I have a string like postfix/smtpd[25532]: I want to cut it off at the [ so I end up with postfix/smtpd how do i do it? -- Nick Rout <[EMAIL PROTECTED]>