We are starting a new proxy server at work and have a list of domains that are to be blocked; the list is downloaded from an external site.
To place them in Squid format we have to add a .
to the beginning of the line which we currently have setup simply /bin/sed -i 's/^/./' $file
The problem we have come across is that some of the files include IP addresses (which we would not like to add a leading .
to)
I’ve been playing around with sed more and think this should work but it doesn’t:
sed '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/s/^\.//g'
Can someone either suggest how I can remove the leading .
from IP addresses, or even modify the first command to not add the .
to IP addresses?
Here is a list of sample data domain names after the .
has been added to the beginning of every line:
.216.32.68.172
.216.32.68.173
.216.32.68.188
.216.32.90.27
.216.32.90.28
.216.32.94.117
.21ace.com
.21publish.com
.21wuxia.com
.222z.net
.22dakika.org
.23-net.org
.23zone.de
.244.120.232.72.static.reverse.ltdomains.com
.24hourcafe.biz.ly