Re: [CentOS] Log File Reviewing

2009-01-06 Thread Kai Schaetzl
com Bill Campbell wrote on Mon, 5 Jan 2009 16:02:29 -0800: (which we are running for Zope compatibility as the version of Zope we're running doesn't work with python-2.5.x. you did realize that this is another python compatibility issue, did you ;-) Kai -- Kai Schätzl, Berlin, Germany Get

Re: [CentOS] Log File Reviewing

2009-01-06 Thread Bill Campbell
On Tue, Jan 06, 2009, Kai Schaetzl wrote: com Bill Campbell wrote on Mon, 5 Jan 2009 16:02:29 -0800: (which we are running for Zope compatibility as the version of Zope we're running doesn't work with python-2.5.x. you did realize that this is another python compatibility issue, did you ;-)

Re: [CentOS] Log File Reviewing

2009-01-06 Thread Les Mikesell
Spiro Harvey wrote: Les Mikesell lesmikes...@gmail.com wrote: Don't count on the same stability with python. It has an annoying habit of changing syntax in non-backwards compatible ways with no You seem to be hell-bent (excuse the pun) on turning this into a jihad on scripting languages.

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Bill Campbell
On Mon, Jan 05, 2009, Joseph L. Casale wrote: I need to review a logfile with Sed and cut out all the lines that start with a certain word, problem is this word begins after some amount of whitespace and unless I search for whitespace at the beginning followed by word I may encounter word

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Paul Heinlein
On Mon, 5 Jan 2009, Joseph L. Casale wrote: I need to review a logfile with Sed and cut out all the lines that start with a certain word, problem is this word begins after some amount of whitespace and unless I search for whitespace at the beginning followed by word I may encounter word

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Joshua Gimer
What about: perl -ne 'if (/^\s*word/) { print $_; }' logfile any others? On Mon, Jan 5, 2009 at 11:45 AM, Joseph L. Casale jcas...@activenetwerx.com wrote: I need to review a logfile with Sed and cut out all the lines that start with a certain word, problem is this word begins after some

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Spiro Harvey
awk '$1 == word{print}' /var/log/messages This example assumes that word is the first field and that it consists only of word. If the first field is word1 this won't match. Fixes for this are awk '$1 ~ word{print}' (this matches any occurrance of word in the first field) or: awk

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Joseph L. Casale
The regex you want is ^[[:space:]]*word Wow, thanks everyone for the help! How does one modify this to also knock out lines that *must* have whitespace followed by a number [0-9]? I can do it using ^[[:space:]]*[0-9] but it also takes out lines w/o whitespace that begin with numbers? I have to

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Spiro Harvey
[0-9]? I can do it using ^[[:space:]]*[0-9] but it also takes out lines w/o whitespace that begin with numbers? to match one or more, use + instead of *. * matches 0 or more, + matches 1 or more. I have to buy a book on RegEx's and Sed :) http://www.gnu.org/manual/gawk/gawk.pdf (G)awk is

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Paul Heinlein
On Mon, 5 Jan 2009, Joseph L. Casale wrote: The regex you want is ^[[:space:]]*word Wow, thanks everyone for the help! How does one modify this to also knock out lines that *must* have whitespace followed by a number [0-9]? I can do it using ^[[:space:]]*[0-9] but it also takes out lines

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Joseph L. Casale
to match one or more, use + instead of *. * matches 0 or more, + matches 1 or more. Thanks! I have to buy a book on RegEx's and Sed :) http://www.gnu.org/manual/gawk/gawk.pdf (G)awk is pretty sh!t hot where I work; however we've extended it a bit. :) So gawk does all that sed does and more?

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Spiro Harvey
So gawk does all that sed does and more? I suppose I can start with Can't really answer that. In 15 years of using UNIX systems, I've never touched sed. :) With Gawk's BEGIN and END blocks you can use it to write full programs, which is kind of nice. that in this case, I always wanted a book

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Steve Huff
On Jan 5, 2009, at 2:56 PM, Joseph L. Casale wrote: The regex you want is ^[[:space:]]*word Wow, thanks everyone for the help! How does one modify this to also knock out lines that *must* have whitespace followed by a number [0-9]? I can do it using ^[[:space:]]*[0-9] but it also takes

Re: [CentOS] Log File Reviewing

2009-01-05 Thread William L. Maltby
On Mon, 2009-01-05 at 13:40 -0700, Joseph L. Casale wrote: to match one or more, use + instead of *. * matches 0 or more, + matches 1 or more. Thanks! snip So gawk does all that sed does and more? I suppose I can start with Tons. You can write fairly complex programs with (g)awk. It

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Les Mikesell
Joseph L. Casale wrote: to match one or more, use + instead of *. * matches 0 or more, + matches 1 or more. Thanks! I have to buy a book on RegEx's and Sed :) http://www.gnu.org/manual/gawk/gawk.pdf (G)awk is pretty sh!t hot where I work; however we've extended it a bit. :) So gawk

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Spiro Harvey
Why not just start with perl which does more than sed/awk while using similar syntax (if you want)? This is why: awk '/^[[:space:]]*word/ {print}' logfile vs perl -ne 'if (/^\s*word/) { print $_; }' logfile Which syntax is likely to be easier to remember? -- Spiro Harvey

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Les Mikesell
Spiro Harvey wrote: Why not just start with perl which does more than sed/awk while using similar syntax (if you want)? This is why: awk '/^[[:space:]]*word/ {print}' logfile vs perl -ne 'if (/^\s*word/) { print $_; }' logfile Which syntax is likely to be easier to remember?

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Bill Campbell
On Tue, Jan 06, 2009, Spiro Harvey wrote: Why not just start with perl which does more than sed/awk while using similar syntax (if you want)? This is why: awk '/^[[:space:]]*word/ {print}' logfile vs perl -ne 'if (/^\s*word/) { print $_; }' logfile Which syntax is likely to be easier to

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Les Mikesell
Bill Campbell wrote: I used to some pretty complex shell and awk scripts before learning perl about 20 years ago. Perl allowed me to do most things in a single language including fairly low-level system calls that I previously had to do with compiled ``C'' programs. And you can probably

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Spiro Harvey
Les Mikesell lesmikes...@gmail.com wrote: Don't count on the same stability with python. It has an annoying habit of changing syntax in non-backwards compatible ways with no You seem to be hell-bent (excuse the pun) on turning this into a jihad on scripting languages. Please take the credo of

Re: [CentOS] Log File Reviewing

2009-01-05 Thread Bill Campbell
On Mon, Jan 05, 2009, Les Mikesell wrote: Bill Campbell wrote: I used to some pretty complex shell and awk scripts before learning perl about 20 years ago. Perl allowed me to do most things in a single language including fairly low-level system calls that I previously had to do with