Sed is a brilliant function to delete or replace strings. I often used sed for replacing (a group of) words or deleting lines.
How to remove a line containing a string in sed:
sed -i '/string/d' /home/admin/filename.txt
How to replace a string in sed:
sed -i 's/#Port 22/Port 12340/g' /etc/ssh/sshd_config
How to remove white lines from ie a .ini file with sed:
sed -i '/^\s*$/d' /usr/local/directadmin/conf/directadmin.conf