Monday, October 31, 2016

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.


No comments:

Post a Comment

Cybermap

Internet Storm Center Infocon Status

Internet Storm Center Infocon Status
Internet Storm Center Infocon Status