[Gllug] Excluding matches with grep

Andrew Halliwell ah at gnd.com
Mon Jan 26 12:32:27 UTC 2004


And verily, didst Dylan announce to the hordes:
> 
> 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

grep SuSE-FW /var/log/gateway.messages | grep -v martian | grep -v SPT=53 >ft.txt 
:)
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list