clear if [ ! -d /usr/abis/dfgz/ ]; then mkdir /usr/abis/dfgz; fi cd /usr/abis/dfgz geshidingyi() { clear echo "\n代发工资报盘数据格式定义\n\n注意:此操作每个合约只需做一次" echo "\n请输入代发单位合约号[12位]:\c" read hy if [ "$hy" = "0" -o "$hy" = "" ]; then exit; fi ws=`expr length $hy` if [ $ws != 12 ]; then echo "\n输入的合约号[$ws]位,要求[12]位,请重新输入!!\c";read lkj; exit; fi grep "ac_94=$hy" /usr/combus/COMBUS.CFG>/dev/null if [ $? = 0 ]; then echo "\n合约号已建立,无需再次导入数据格式!!\c";read lkj;exit else echo " begin ac_94=$hy fmt=5 8 20 10 6 18 6 1 2 seq=1 6 14 34 44 50 68 74 75 end ">/tmp/combus.cfg cat /usr/combus/COMBUS.CFG>>/tmp/combus.cfg cp /tmp/combus.cfg /usr/combus/COMBUS.CFG echo "\n合约号[$hy]已成功导入数据格式!\c";read jlk;exit fi } xinkaihu() { if [ ! -f /usr/tmp/wddh ]; then echo "\n请输入网点代码(4135):\c" read dm echo "$dm">/usr/tmp/wddh fi read wddhcd /usr/abis/acbs/dat/reportdir l P$wddh* echo "\n新开户文件如上" echo "\n请输入正确文件名后7位:\c" read xxh if [ ! "$xxh" ]; then exit; fi if [ `expr length $xxh` != 7 ]; then echo "\n输入错误,请重新输入!!\c";read jlk;exit;fi cp P$wddh$xxh xkh.tmp cut -c33-39 xkh.tmp>gzhm cut -c93-107 xkh.tmp>gzzh.xkh cut -c117-126 xkh.tmp>gzje cut -c133-151 xkh.tmp>gzsfz paste gzhm gzzh.xkh gzje gzsfz>dfgzxkh.tmp rm -f gzhm gzzh.xkh gzje gzsfz xkh.tmp sed 's/ //g' dfgzxkh.tmp|awk '{if(NF>3) print $0}'>dfgzxkh.txt head dfgzxkh.txt echo "\n\n新开户数:`cat dfgzxkh.txt|wc -l` \c" rq=` date +%m$d` cp dfgzxkh.txt xkh$rq.txt awk '{x=x+$3};END{printf"新开户金额:%1.2f\n",x}' dfgzxkh.txt cat xkh$rq.txt>>/usr/abis/dfgz/xkhgzz.old rm -f dfgzxkh.tmp echo "\n\n是否拷出文件?\c" read kc if [ "$kc" != "1" ]; then exit else doscp -m xkh$rq.txt a: fi } echo "\n [7m代发工资文本格式转换程序[0m \n[1m Version 6.0 zbh 2006.3.31 TEL:0536-8193150[0m \n文件类型为文本格式,若为Excel格式,请用'另存为'转换(制表符分隔). \n基本格式为:户名 帐号/身份证号 金额,其中[分隔符为TAB或|或空格] \n注意:分隔符不能为(,),文件名=a为定义合约格式,=x导出新开户帐号. \n是否需要从软盘拷入?需要时输入文件名(*.txt): \c" read wjm if [ ! "$wjm" ] ; then continue;cp gz.txtt gz.txt bz=1 elif [ $wjm = 0 ] ; then exit elif [ $wjm = a ] ; then geshidingyi; elif [ $wjm = x ] ; then xinkaihu; else doscp -m a:$wjm gz.txtt cp gz.txtt gz.txt bz=0 fi echo "\n\n正在转换请稍候......\c" vi gz.txt</dev/null :g/"/s///g :g/\,/s///g :g/ /s// /g :g/|/s// /g :g/ /s// /g :g/ /s// /g :g/ /s// /g :x eof awk '{if ($3>0) print $0 }' gz.txt>gz.txt1 awk '{b=length($2)}{if(b!=15&&b!=18&&b!=19) print $0}' gz.txt1>/tmp/dfgz.err if [ -z /tmp/dfgz.err ]; then echo "\n代发工资帐号或身份证号误清单如下:\n" cat /tmp/dfgz.err echo "\n请更正后重新转换!!\c";read jkl;exit fi awk '{b=substr($2,5,5);a=substr($2,1,5)}{if(b==01100||b==00460||a==62284||a==95599||a==10340) print $1"|"$2"|"$3; else print $1"||"$3"|110001|"$2}' gz.txt1>gz.txtz grep "|110001|" gz.txtz>gz.txt0 sed '/|110001|/d' gz.txtz>>gz.txt0 rm -f gz.txtz awk -F"|" 'BEGIN { i=10001} { printf "%6s%-8s%20s%10.2f%6s%-18s\n", i,$1,$2,$3,$4,$5 i++} END{ }' gz.txt0>gz.txti echo "\n";cp gz.txti /usr/combus/txti/888 clear;head -18 /usr/combus/txti/888 awk -F"|" '{s=s+$3;z++;if($4==110001) i++};END{printf "\n代发总金额:[%-1.2f] 总笔数:[%d]户 其中:新开户[%d]户\n",s,z,i}' gz.txt0 echo "\n注意事项:转换成功,请用9208导入数据,文件名为888." echo "\n[7m爱心提示:若有新开户,请注意凭证箱第二段是否足量!![0m \c";read jkl
| | |