diff options
Diffstat (limited to 'postpost/adj_input_param')
-rwxr-xr-x | postpost/adj_input_param | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/postpost/adj_input_param b/postpost/adj_input_param new file mode 100755 index 0000000..33137a1 --- /dev/null +++ b/postpost/adj_input_param @@ -0,0 +1,30 @@ +#!/bin/sh +# usage: ./adj_input_param &key name value fromfile > tofile + +alles=$(grep -c ".*" $4) +ln=0 +for n in $(grep -n "$2 " $4 | tr ":" " " | awk '{ print $1; }' | sort -n) +do + if [ ! "$(head -n$n "$4" | grep "^&" | tail -n1)" == "$1" ] + then + continue + fi + tail -n$[$alles - $ln] "$4" | head -n$[$n-$ln-1] + ln=$n + s=$(grep -n "$2" $4 | grep "^$n:") + t=$(echo "$s" | tr "#: " " #" | awk '{ print $2; }') + len=${#t} + t="#"$(echo "$s" | tr "# " " #" | awk '{ print $2; }' | tr "# " " #") + s=$(echo "$s" | tr " =:#" ": " | awk '{print $2 " :'$3'"; }' | tr ": " " =") + while [ ${#s} -lt $len ] + do + s=$s" " + done + echo "$s$t" +## grep -n "$2" $4 | grep "^$n:" | tr " =:#" ": " | awk '{print $2 " :'$3'" "::#"$4; }' | tr ": " " =" +## grep -n "$2 " $4 | grep "^$n:" | tr " =:" ": " | awk '{ print $2 " :'$3'"; }' | tr ": " " =" +## echo "period_stop = "$[$(grep "prop_stop" $1 | awk '{ print $3; }')-1] +done + +tail -n$[$alles-$ln] "$4" + |