mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Remove lines with ABP extended CSS selector
Co-authored-by: Adam Warner <me@adamwarner.co.uk> Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
61ff5b2c76
commit
cc17fe18a9
1 changed files with 9 additions and 7 deletions
16
gravity.sh
16
gravity.sh
|
@ -768,18 +768,20 @@ gravity_ParseFileIntoDomains() {
|
||||||
tr '[:upper:]' '[:lower:]' < "${src}" > "${destination}"
|
tr '[:upper:]' '[:lower:]' < "${src}" > "${destination}"
|
||||||
|
|
||||||
# 2) Remove carriage returns
|
# 2) Remove carriage returns
|
||||||
# 3) Remove comments (text starting with "#", include possible spaces before the hash sign)
|
# 3) Remove lines starting with ! (ABP Comments)
|
||||||
# 4) Remove lines starting with ! (ABP Comments)
|
# 4) Remove lines starting with [ (ABP Header)
|
||||||
# 5) Remove lines starting with [ (ABP Header)
|
# 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#")
|
||||||
# 6) Remove lines containing "/"
|
# 6) Remove comments (text starting with "#", include possible spaces before the hash sign)
|
||||||
# 7) Remove leading tabs, spaces, etc. (Also removes leading IP addresses)
|
# 7) Remove lines containing "/"
|
||||||
# 8) Remove empty lines
|
# 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses)
|
||||||
|
# 9) Remove empty lines
|
||||||
|
|
||||||
sed -i -r \
|
sed -i -r \
|
||||||
-e 's/\r$//' \
|
-e 's/\r$//' \
|
||||||
-e 's/\s*#.*//g' \
|
|
||||||
-e 's/\s*!.*//g' \
|
-e 's/\s*!.*//g' \
|
||||||
-e 's/\s*\[.*//g' \
|
-e 's/\s*\[.*//g' \
|
||||||
|
-e '/\#[!|?|@]{0,1}\#/d' \
|
||||||
|
-e 's/\s*#.*//g' \
|
||||||
-e '/(\/).*$/d' \
|
-e '/(\/).*$/d' \
|
||||||
-e 's/^.*\s+//g' \
|
-e 's/^.*\s+//g' \
|
||||||
-e '/^$/d' "${destination}"
|
-e '/^$/d' "${destination}"
|
||||||
|
|
Loading…
Reference in a new issue