From 6fc15d9f066575c1ebc25fe24dbafad18871b8b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 30 Aug 2015 11:01:38 +0200 Subject: [PATCH] add script to change lights --- scripts/modify_lights.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/modify_lights.sh diff --git a/scripts/modify_lights.sh b/scripts/modify_lights.sh new file mode 100755 index 00000000..3482d208 --- /dev/null +++ b/scripts/modify_lights.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# run : script runningman.map + +FILE=$1 +FACTOR=$2 +IFS=$'\n' +set -f +for line in $(< $1 ); do + if [[ ${line} == *"light"* ]] && [[ `echo $line | awk '{print $1}' | grep -e "\\\\""light" | grep "\""` ]]; then + echo $line + VALUE=`echo $line | cut -d' ' -f2 | sed 's/"//g'` + echo $VALUE + echo '"light"' \"`calc -p ${VALUE}/${FACTOR} | sed s/~//g`\" >> tmp + else + echo $line >> tmp + fi + +done < $1 + +mv tmp $1 -- 2.39.2