[Gllug] Excluding matches with grep
Ian Norton
bredroll at darkspace.org.uk
Sun Jan 25 19:35:46 UTC 2004
On Sun, Jan 25, 2004 at 06:35:42PM +0000, Dylan wrote:
> 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?
>
> Cheers
>
> Dylan
grep SuSE-FW /var/log/gateway.messages |grep -v martian | grep -v SPT=53 > fw.txt
Ian
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list