1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-15 20:49:01 +00:00

Merge pull request #1466 from pi-hole/doclist_remove_sed

Document `sed` substitution for user readability
This commit is contained in:
Dan Schaper 2017-05-14 08:28:10 -07:00 committed by GitHub
commit d30056026b

View File

@ -158,6 +158,10 @@ RemoveDomain() {
# Remove it from the other one
echo "::: Removing $1 from $list..."
# Busybox sed compatible case-insensitive domain removal
# grep case insensitive domain from list, print line numbers
# split on ':' with awk and print the line number
# For conditions with more than one match, substitute newline with ','
# sed substitute final trailing ',' with newline
sed -i "$(grep -in "^${domain}$" ${list} | awk -F':' '{print $1}' | tr '\n' ',' | sed 's/,$/\n/')d" ${list}
reload=true
else