hive导出数库建表语句

脚本内容如下:

hive -e “show databases;” > /home/eptok/tb.txt
dir=/home/eptok/tb.txt
dir1=/home/eptok/tb1.txt
dir2=/home/eptok/ods.txt
cat d i r ∣ w h i l e r e a d l i n e d o r e s u l t = ‘ e c h o " dir | while read line do result=`echo " dirwhilereadlinedoresult=echo"line"`
echo $result
if [ $result != “” ];then
hive -e “use $result;show tables;” > ${dir1}
cat $dir1 | while read line1
do
if [ $line1 != “tab_name” ];then
echo r e s u l t . result. result.line1 >> ${dir2}
hive -e “use $result;show create table r e s u l t . result. result.line1;” | grep -v createtab_stmt >> ods.sql
fi
done
fi
done

你可能感兴趣的:(hive,hdfs)