Jan,

On Wednesday 07 February 2007 15:30, Jan Karjalainen wrote:
> ...
> > On Wednesday 07 February 2007 15:19, Jan Karjalainen wrote:
> >> I'm trying to parse through a file and delete all the lines with
> >> the word "LOG" on it, eg. replace it with "".
> >
> > ...
>
> I found the expression:  .+LOG.+

You're still making it too complicated for programs such as ed, vi, 
grep, egrep or sed, patterns are not required to match the whole line. 
That means the ".+" parts are redundant. If you really want to exclude 
from treatment those lines where "LOG" occurs at the beginning or end, 
then use the pattern ".LOG." (sans quotes, of course).

Under some circumstances regular expression efficiency matters little, 
but given the size to which log files can grow, more efficient regular 
expressions are worth using.

So here's what you want to do:

% sed -e '/LOG/d' originalLogFile >filteredLogFile

If you really want to exclude those lines where LOG occurs at the 
beginning or end, then use this:

% sed -e '/.LOG./d' originalLogFile >filteredLogFile


Randall Schulz
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to