bash - Need grep statement to exclude lines -


i running ufw in "open" mode collect stats see if there attempts access server. ufw running in "medium" logging can see access server. when check ufw.log, need run through whole list manually.

i use:

grep 'in=eth0' uwf.log 

but still leaves many records me check manually

what need is:

  • grep must lines contain in=eth0 ( part easy)
  • grep must ignore lines src=0.0.0.0 (these dhcp broadcasts)
  • grep must ignore lines src=10.0.1.15 (10.0.x.x nagios checking ftp service)

can please help,

thank you.

i use awk:

awk '/in=eth0/ && !/src=0\.0\.0\.0/ && !/src=10\.0\.1\.15/' uwf.log 

since awk supports boolean operations, multiple conditions can expressed in pretty simple way.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -