summaryrefslogtreecommitdiff
path: root/postpost/adj_input_param
blob: 33137a1ce3f675735b19edafe87b5c55081171ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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"