From 25601b9fcc4a87220cbd641deaf2f079b71994ee Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 13 May 2017 17:49:58 -0700 Subject: [PATCH] Document `sed` substitution for user readability Comment the oneliner with explanations of what each step does. --- advanced/Scripts/list.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 52c4c569..05806e46 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -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