How to delete lines (not) containing specific string

How to delete lines (not) containing specific string

Remove lines not containing 2016-10-30
 sed -i.bak '/2016-10-30/!d' ./log.txt

 Remove lines  containing 2016-10-30
  sed -i.bak '/2016-10-30/d' ./log.txt


option -i.bak will create backup file.


Comments

Popular posts from this blog

How to clean DB from old logs in Magento 1.x

Securing the Pi-hole with fail2ban to prevent DNS Amplification attacks

Apache 2.4 + mod_wsgi + Python 3.7 + Django installation on Centos 7.10