Fix ^M showing up in some lists

This commit is contained in:
columndeeply
2022-12-25 11:17:52 +01:00
parent c770f01bd1
commit 14eccc4c6d

View File

@ -20,8 +20,8 @@ for file in "$@"; do
## Remove any lines pointing to an IP address, hosts file only works with domains or hostnames ## Remove any lines pointing to an IP address, hosts file only works with domains or hostnames
sed -i -r '/ ([0-9]{1,3}\.){3}[0-9]{1,3}$/d' "$file" sed -i -r '/ ([0-9]{1,3}\.){3}[0-9]{1,3}$/d' "$file"
# Remove multiple spaces (If anybody knows how to do this with sed please let me know) # Remove multiple spaces and return lines (If anybody knows how to do this with sed please let me know)
tr -s ' ' < "$file" > "$file.tmp" tr -s ' ' < "$file" | tr -d '\r' > "$file.tmp"
# Remove any domain that exists in the whitelist # Remove any domain that exists in the whitelist
grep -v -x -f ../whitelist "$file.tmp" > "$file.tmp2" grep -v -x -f ../whitelist "$file.tmp" > "$file.tmp2"