</pre><pre code_snippet_id="677645" snippet_file_name="blog_20150528_2_4424221" name="code" class="html">
#!/bin/bash
#处理文件所在的目录
fileDir="/bigdata/dbdata/BI_Export/back"
# 处理后文件还是原来的文件
for file in `cat /web/cmd/filelist`
do
echo "---------- $fileDir/$file----------"
## file convert Transcoding
enconv -L zh_CN -x UTF-8 $fileDir/$file
## remove \t
sed -i 's/\t//g' $fileDir/$file
## remove space
sed -i 's/ //g' $fileDir/$file
## read /web/cmd/sedfile and remove Special symbols
sed -i -f /web/cmd/sedfile $fileDir/$file
## remove \n
sed -i ':label;N;s/\n//;b label' $fileDir/$file
#### zheng he
sed -i 's/\!\#\%\&\@\$\^\*\@\!-S\./\n/g' $fileDir/$file
sed -i 's/\@\$\^\*\!\#\%\&\!\@/\t/g' $fileDir/$file
done
hang
lie
#对文件进行转码
#enconv -L zh_CN -x UTF-8 "/bigdata/dbdata/BI_Export/back/file_2015-04-13.txt"
## 去掉tab键 remove \t
#sed -i 's/\t//g' "/bigdata/dbdata/BI_Export/back/<span style="font-family: Arial, Helvetica, sans-serif;">file</span><span style="font-family: Arial, Helvetica, sans-serif;">_2015-04-13.txt"</span>
## 去掉空格 remove space
#sed -i 's/ //g' "/bigdata/dbdata/BI_Export/back/AccMain_CourseEdu_Type_2015-04-13.txt"
## read /web/cmd/sedfile and remove Special symbols
#sed -i -f /web/cmd/sedfile "/bigdata/dbdata/BI_Export/back/AccMain_CourseEdu_Type_2015-04-13.txt"
## remove \n
# sed -i ':label;N;s/\n//;b label' "/bigdata/dbdata/BI_Export/back/AccMain_CourseEdu_Type_2015-04-13.txt"
#### zheng he
#sed -i 's/\!\#\%\&\@\$\^\*\@\!-S\./\n/g' "/bigdata/dbdata/BI_Export/back/AccMain_CourseEdu_Type_2015-04-13.txt"
#sed -i 's/\@\$\^\*\!\#\%\&\!\@/\t/g' "/bigdata/dbdata/BI_Export/back/AccMain_CourseEdu_Type_2015-04-13.txt"
#! /bin/sh
#打印输出两个时间字符串日期
date="$1"
enddate=`date -d " +0 day $2" +%Y%m%d`
date2="$1"
enddate2=`date -d " +0 day $2" +%Y-%m-%d`
while [[ $date < $enddate && $date2 < $enddate2 ]]
do
#echo $date > test_log.log 2>&1
date=`date -d "+1 day $date" +%Y%m%d`
echo $date
date2=`date -d "+1 day $date2" +%Y-%m-%d`
echo $date2
echo '.........................执行hive脚本命令....................'
done