#! /bin/sh

LIST="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16"

for i in $LIST
do
  SOURCE=mlerun_$i/cbs.usrvar.pf
  TARGET=pedist_$i/cbs.usrvar.pf
  printf "%s %s %s \n" ${SOURCE} " -> " ${TARGET}
  sed "-e s/0     task/5     task/" "-e s/    0     Increa/20000     Increa/" \
    ${SOURCE} > ${TARGET}
  SOURCE=mlerun_$i/cbs.parm.000
  TARGET=pedist_$i/theta.txt
  printf "%s %s %s \n" ${SOURCE} " -> " ${TARGET}
  sed -n '/Beta/ p' ${SOURCE} > ${TARGET}
  sed -n '/Gamma/ p' ${SOURCE} >> ${TARGET}
done
