Replaces double quotes by single quotes and updates documentation.

Signed-off-by: xch12i5 <40517505+xCh12i5@users.noreply.github.com>
This commit is contained in:
xch12i5 2019-01-19 17:48:29 +01:00
parent 0de5132e2b
commit e02da90faa
1 changed files with 10 additions and 8 deletions

View File

@ -335,14 +335,16 @@ gravity_ParseFileIntoDomains() {
# Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious # Most of the lists downloaded are already in hosts file format but the spacing/formating is not contigious
# This helps with that and makes it easier to read # This helps with that and makes it easier to read
# It also helps with debugging so each stage of the script can be researched more in depth # It also helps with debugging so each stage of the script can be researched more in depth
# Awk -F splits on given IFS, we grab the right hand side (chops trailing #coments and /'s to grab the domain only. # 1) Remove carriage returns
# Last awk command takes non-commented lines and if they have 2 fields, take the right field (the domain) and leave # 2) Convert all characters to lowercase
# the left (IP address), otherwise grab the single field. # 3) Remove lines containing "#" or "/"
< ${source} tr -d '\r' | \ # 4) Remove leading tabs, spaces, etc.
tr '[:upper:]' '[:lower:]' | \ # 5) Delete lines not matching domain names
sed -r '/(\/|#).*$/d' | \ < ${source} tr -d "\r" | \
sed -r 's/^.*\s+//g' | \ tr "[:upper:]" "[:lower:]" | \
sed -r '/([^\.]+\.)+[^\.]{2,}/!d' > ${destination} sed -r "/(\/|#).*$/d" | \
sed -r "s/^.*\s+//g" | \
sed -r "/([^\.]+\.)+[^\.]{2,}/!d" > ${destination}
return 0 return 0
fi fi