mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Clarify what the command is doing.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
c97cfde9f9
commit
c9fe62a691
1 changed files with 8 additions and 2 deletions
10
gravity.sh
10
gravity.sh
|
@ -288,8 +288,14 @@ gravity_advanced() {
|
||||||
echo -n "::: Formatting list of domains to remove comments...."
|
echo -n "::: Formatting list of domains to remove comments...."
|
||||||
#awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
#awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||||
#Above line does not correctly grab domains where comment is on the same line (e.g 'addomain.com #comment')
|
#Above line does not correctly grab domains where comment is on the same line (e.g 'addomain.com #comment')
|
||||||
#Add additional awk command to read all lines up to a '#', and then continue as we were
|
#Awk -F splits on given IFS, we grab the right hand side (chops trailing #coments and /'s to grab the domain only.
|
||||||
cat ${piholeDir}/${matterAndLight} | awk -F'#' '{print $1}' | awk -F'/' '{print $1}' | awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
#Last awk command takes non-commented lines and if they have 2 fields, take the left field (the domain) and leave
|
||||||
|
#+ and leave the right (IP address), otherwise grab the single field.
|
||||||
|
cat ${piholeDir}/${matterAndLight} | \
|
||||||
|
awk -F '#' '{print $1}' | \
|
||||||
|
awk -F '/' '{print $1}' | \
|
||||||
|
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | \
|
||||||
|
sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
numberOf=$(wc -l < ${piholeDir}/${supernova})
|
numberOf=$(wc -l < ${piholeDir}/${supernova})
|
||||||
|
|
Loading…
Reference in a new issue