Shell 脚本

</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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值