linux shell read line,shell read line用法

该脚本主要涉及自动化数据加载过程,通过检查bakfile是否存在,执行数据清理并创建目录。然后,使用xsql工具从table.dat读取数据,逐条加载到指定的数据库表中,并将数据导出到bakfile目录下,确保文件权限为777。整个流程旨在实现高效的数据管理和备份。
摘要由CSDN通过智能技术生成

bakfile="/home/zxin10/bakdata"

if [ -e $bakfile ];

then

rm -rf /home/zxin10/bakdata/*

else

mkdir $bakfile

chmod 777 $bakfile

fi

cat table.dat | while read line

do

echo "start to load table $line out..."

/home/zxin10/bin/xsql -s127.0.0.1 -p8433 -e "Load data outfile '$bakfile/$line.dat' from table $line field_term '|';"

echo "start to load table $line out end"

done

while read line

do

echo $line

done

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值