#!/bin/bash 
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

datai=2023120100
dataf=2024030100

datai=2010010100
dataf=2024123123

scr=/share/ioper/tempo/MERGE/GOES/OBS 
out=/share/ioper/tempo/MERGE/GOES/OBS/BDM 

while [ ${datai} -le ${dataf} ]; do
 echo $datai
 mkdir -p $out/${datai:0:6}
 cd $out/${datai:0:6}
 /oper/bdados/ons/retrieve  --h  --i ${datai}  --f ${datai}  --o T_${datai}_tmp.txt
 cat T_${datai}_tmp.txt|awk  '{print $1"  "$4"  "$2"  "$3"  "$7}' > PREC_BDM_${datai}.txt
 rm -f T_${datai}_tmp.txt
 datai=`date -d "${datai:0:8} ${datai:8:10}:00 1 hours" +"%Y%m%d%H"`
done
