From 55f78e3b64470f82e088ecc714187ac5dd972456 Mon Sep 17 00:00:00 2001 From: Adam Hill Date: Sat, 13 May 2017 18:44:41 -0500 Subject: [PATCH] Update list.sh I believe this has feature parity with `sed /foo/ Id` but also supports busybox, and my alpine docker ;) --- advanced/Scripts/list.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 537ebac3..52c4c569 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -157,8 +157,8 @@ RemoveDomain() { if [[ "${bool}" == true ]]; then # Remove it from the other one echo "::: Removing $1 from $list..." - # /I flag: search case-insensitive - sed -i "/${domain}/Id" "${list}" + # Busybox sed compatible case-insensitive domain removal + sed -i "$(grep -in "^${domain}$" ${list} | awk -F':' '{print $1}' | tr '\n' ',' | sed 's/,$/\n/')d" ${list} reload=true else if [[ "${verbose}" == true ]]; then @@ -174,8 +174,8 @@ RemoveDomain() { if [[ "${bool}" == true ]]; then # Remove it from the other one echo "::: Removing $1 from $list..." - # /I flag: search case-insensitive - sed -i "/address=\/${domain}/Id" "${list}" + # Busybox sed compatible case-insensitive domain removal + sed -i "$(grep -in "/${domain}/" ${list} | awk -F':' '{print $1}' | tr '\n' ',' | sed 's/,$/\n/')d" ${list} reload=true else if [[ "${verbose}" == true ]]; then