shell 切割文件
[root@hadoop2 xiaole_chk_url]# cat looh.index.splitfile.sh
loop_c=0
loop_step=10001
loop_tag=0
str_head='{"delete":{"_id":"'
str_foot='"}}'
bulk_file=bulk.index.del.splitfile.json
split_file_dir='/root/xiaole_chk_url/splitfile/'
bulk_file_sub=${split_file_dir}${bulk_file}
echo bulk_file
log_file=bulk.index.del.splitfile.json.log
echo '' > $bulk_file
for LINE in `cat /root/chk_url_404_pure_url_small_150000.txt`
do
loop_c=$((loop_c+1))
loop_tag=$((loop_c%loop_step))
echo ${str_head}$LINE${str_foot} >> $bulk_file_sub
if [ $loop_tag -eq 0 ]
then
bulk_file_sub=${split_file_dir}$((loop_c))${bulk_file}
echo $loop_c
echo $bulk_file_sub
sleep 20s
echo '' > $bulk_file_sub
else
continue
fi
done
echo $loop_c
echo
exit 0
[root@hadoop2 xiaole_chk_url]#