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

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

Reduce (shrink) and resize raw disk at Proxmox

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