shell 右对齐左空格例子

#/bin/sh
#name: fileDeal.sh
#author: baijd(baijd@neusof.com)
#date:2011.11.03

#配置文件路径
CONF_NAME=/home/intf/baijd/dataIntf/IncomeInput/fileDeal.ini

#沈阳910配置
STAT_INDEX910=`grep -n "910_start" ${CONF_NAME} | cut -d: -f1`
END_INDEX910=`grep -n "910_end" ${CONF_NAME} | cut -d: -f1`
CONFIG_TEXT910="sed -n ${STAT_INDEX910},${END_INDEX910}p ${CONF_NAME}"

DATA_SOURCE910=`${CONFIG_TEXT910} | grep "DATA_SOURCE" | cut -d= -f2`
DATA_MONTH910=`${CONFIG_TEXT910} | grep "DATA_MONTH" | cut -d= -f2`
DATA_PATH910=`${CONFIG_TEXT910} | grep "DATA_PATH" | cut -d= -f2`
CHECKFILE_NO910=`${CONFIG_TEXT910} | grep "CHECKFILE_NO" | cut -d= -f2`
SPLITEXE_PATH910=`${CONFIG_TEXT910} | grep "SPLITEXE_PATH" | cut -d= -f2`
TMP_PATH910=`${CONFIG_TEXT910} | grep "TMP_PATH" | cut -d= -f2`

#铁岭911配置
STAT_INDEX911=`grep -n "911_start" ${CONF_NAME} | cut -d: -f1`
END_INDEX911=`grep -n "911_end" ${CONF_NAME} | cut -d: -f1`
CONFIG_TEXT911="sed -n ${STAT_INDEX911},${END_INDEX911}p ${CONF_NAME}"

DATA_SOURCE911=`${CONFIG_TEXT911} | grep "DATA_SOURCE" | cut -d= -f2`
DATA_MONTH911=`${CONFIG_TEXT911} | grep "DATA_MONTH" | cut -d= -f2`
DATA_PATH911=`${CONFIG_TEXT911} | grep "DATA_PATH" | cut -d= -f2`
CHECKFILE_NO911=`${CONFIG_TEXT911} | grep "CHECKFILE_NO" | cut -d= -f2`
SPLITEXE_PATH911=`${CONFIG_TEXT911} | grep "SPLITEXE_PATH" | cut -d= -f2`
TMP_PATH911=`${CONFIG_TEXT911} | grep "TMP_PATH" | cut -d= -f2`


##################沈阳地区收入归集接口文件处理########################
#沈阳910:写校验文件--start
echo "沈阳910:写校验文件开始......"
cd ${DATA_PATH910}
CHECK_FILE910=`echo ${CHECKFILE_NO910}_${DATA_SOURCE910}_${DATA_MONTH910}`
touch _${CHECK_FILE910}_

for loop in `ls ${DATA_PATH910}/*${DATA_MONTH910}`
do
 REQ_FILE_NAME=`basename $loop`

 FILENAME=`echo ${DATA_PATH910}/${REQ_FILE_NAME}`
 
 FILENUM=`awk '{print NR}' ${FILENAME}|tail -n1`
 
 FILENUM=`echo ${FILENUM} | awk '{printf("%6d",$0)}'`
 REQ_FILE_NAME=`echo ${REQ_FILE_NAME} | awk '{printf("%30s",$0)}'`
 
 echo "${REQ_FILE_NAME}${FILENUM}" >> _${CHECK_FILE910}_
done

mv _${CHECK_FILE910}_ ${CHECK_FILE910}

#沈阳910:写校验文件--end
echo "沈阳910:写校验文件完毕"

 

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/baijd_ss/article/details/6957186
文章标签: shell path file
个人分类: unix&linux
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭