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.
# Hosts File
# Before sed
After sed removes these lines and vim displays the file as follows:
# hosts file
# after sed
I tried various sed commands in my script such as
sed -i /^$/d' $HOSTS
sed -i / *$/d' $HOSTS
this is really bothering me