[Gllug] Excluding matches with grep
Dylan
dylan at dylan.me.uk
Sun Jan 25 19:05:41 UTC 2004
On Sunday 25 January 2004 18:42 pm, Jack Bertram wrote:
> * Dylan <dylan at dylan.me.uk> [040125 18:35]:
> > Hi all,
> >
> > I'm trying to filter some entries from a logfile to a text file.
> > Specifically, I want all firewall entries, except those which I can
> > already explain. For example - I don't want martian packets. So,
> > issuing:
> >
> > cat /var/log/gateway.messages | grep SuSE-FW > fw.txt
> >
> > gets all the firewall messages, then I can re-grep to extract
> > particular things by other patterns, but ideally I'd like to be
> > able to do:
> >
> > cat /var/log/gateway.messages | grep {reg-exp to match all lines
> > with SuSE-FW except (those with martian OR SPT=53 OR ...)} > fw.txt
> >
> > Is this possible with grep?
>
> cat /var/log/gateway.messages | grep 'SuSE-FW' | grep -Ev
> '(martian)|(SPT=53)' > fw.txt
Thank you - that does it!
Dylan
>
> ?
>
> jack
--
"They that can give up essential liberty to obtain a little
temporary safety, deserve neither liberty nor safety."
-Benjamin Franklin
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list