add a hopefully more robust implementation for changing existing values

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2012-02-03 20:50:17 +01:00
parent 23eba4c5e1
commit 85f7880c7e

View file

@ -40,10 +40,7 @@ DONE
else else
# change value # change value
cat << DONE cat << DONE
awk -F "$delimiter" ' sed -i "s|^$key\($delimiter\+\).*|$key\1$value_should|" "$file"
/${key}${delimiter}*/{gsub("$value_is", "$value_should")};{print}' "$file" > "${file}+" \
&& mv "${file}+" "$file"
DONE DONE
fi fi
;; ;;