Hello, On Wed, 07 Feb 2007, Randall R Schulz wrote: >On Wednesday 07 February 2007 15:30, Jan Karjalainen wrote: [..] >> 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).
That means 'one arbitrary character' "LOG" 'one arbitrary character', which is something else. >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 fgrep -v 'LOG' 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 fgrep -v '^LOG\|LOG$' originalLogFile >filteredLogFile -dnh -- Fertility is hereditary. If your parents didn't have any children, neither will you. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]