mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Start counting with 1
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
372070ab39
commit
14ab586603
1 changed files with 5 additions and 5 deletions
10
gravity.sh
10
gravity.sh
|
@ -526,11 +526,11 @@ num_invalid=0
|
||||||
parseList() {
|
parseList() {
|
||||||
local adlistID="${1}" src="${2}" target="${3}" incorrect_lines sample_incorrect_lines
|
local adlistID="${1}" src="${2}" target="${3}" incorrect_lines sample_incorrect_lines
|
||||||
# This sed does the following things:
|
# This sed does the following things:
|
||||||
# 0. Remove all lines containing no domains
|
# 1. Remove all lines containing no domains
|
||||||
# 1. Remove all domains containing invalid characters. Valid are: a-z, A-Z, 0-9, dot (.), minus (-), underscore (_)
|
# 2. Remove all domains containing invalid characters. Valid are: a-z, A-Z, 0-9, dot (.), minus (-), underscore (_)
|
||||||
# 2. Append ,adlistID to every line
|
# 3. Append ,adlistID to every line
|
||||||
# 3. Remove trailing period (see https://github.com/pi-hole/pi-hole/issues/4701)
|
# 4. Remove trailing period (see https://github.com/pi-hole/pi-hole/issues/4701)
|
||||||
# 4. Ensures there is a newline on the last line
|
# 5. Ensures there is a newline on the last line
|
||||||
sed -r "/([^\.]+\.)+[^\.]{2,}/!d;/[^a-zA-Z0-9.\_-]/d;s/\.$//;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}"
|
sed -r "/([^\.]+\.)+[^\.]{2,}/!d;/[^a-zA-Z0-9.\_-]/d;s/\.$//;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}"
|
||||||
|
|
||||||
# Find lines containing no domains or with invalid characters (see above)
|
# Find lines containing no domains or with invalid characters (see above)
|
||||||
|
|
Loading…
Reference in a new issue