mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-24 13:50:17 +00:00
Document sed
substitution for user readability
Comment the oneliner with explanations of what each step does.
This commit is contained in:
parent
db10c8ab46
commit
25601b9fcc
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue