Another drive by post that I can gain valuable experience I guess.
So in writing this script I noticed that when I remove the lines with sed it leaves blank lines where the text is removed.
An example after running the script and sites are removed I still see the blank lines left from where the sites were removed.
Code:
# Hosts File
# Before sed
127.0.0.1 facebook.com
127.0.0.1 myspace.com
~
~
~
After sed removes these lines and vim displays the file as follows:
Code:
# hosts file
# after sed
~
~
~
I tried various sed commands in my script such as
sed -i /^$/d' $HOSTS
and
sed -i / *$/d' $HOSTS
this is really bothering me
