start="2018-06-17"
end="2018-07-01"
min=`date -d "${start}" +%Y%m%d`
max=`date -d "${end}" +%Y%m%d`


[ -e /tmp/fd3 ] || mkfifo /tmp/fd3
exec 5<>/tmp/fd3
rm -rf /tmp/fd3

for ((i=1;i<=5;i++))
do
    echo >&5
done

while [ $min -le $max ]
do
read -u5
date=${min}
echo "date:" ${date}
{
sql="
select * from table where day = ${date} ;"
echo "${sql}"
hive -e "${sql}" > output_${date}.txt
echo >&5
}&  
min=`date -d "1 day ${date}" +%Y%m%d`

done
wait
exec 5<&-
exec 5>&-

 

相关文章:

  • 2022-01-28
  • 2022-01-17
  • 2021-05-22
  • 2021-10-21
  • 2022-02-25
  • 2022-12-23
  • 2021-06-09
  • 2021-07-30
猜你喜欢
  • 2021-12-03
  • 2022-12-23
  • 2021-08-12
  • 2021-11-25
相关资源
相似解决方案