mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-03-25 01:34:21 +00:00
Solves RegEx issue.
Signed-off-by: xch12i5 <40517505+xCh12i5@users.noreply.github.com>
This commit is contained in:
parent
8d85d46c1a
commit
0de5132e2b
1 changed files with 5 additions and 5 deletions
10
gravity.sh
10
gravity.sh
|
@ -338,11 +338,11 @@ gravity_ParseFileIntoDomains() {
|
||||||
# Awk -F splits on given IFS, we grab the right hand side (chops trailing #coments and /'s to grab the domain only.
|
# Awk -F splits on given IFS, we grab the right hand side (chops trailing #coments and /'s to grab the domain only.
|
||||||
# Last awk command takes non-commented lines and if they have 2 fields, take the right field (the domain) and leave
|
# Last awk command takes non-commented lines and if they have 2 fields, take the right field (the domain) and leave
|
||||||
# the left (IP address), otherwise grab the single field.
|
# the left (IP address), otherwise grab the single field.
|
||||||
|
< ${source} tr -d '\r' | \
|
||||||
< ${source} awk -F '#' '{print $1}' | \
|
tr '[:upper:]' '[:lower:]' | \
|
||||||
awk -F '/' '{print $1}' | \
|
sed -r '/(\/|#).*$/d' | \
|
||||||
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | \
|
sed -r 's/^.*\s+//g' | \
|
||||||
sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${destination}
|
sed -r '/([^\.]+\.)+[^\.]{2,}/!d' > ${destination}
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue