如题: 打印前46个字符,后面按567个字符为一次交易
文本文件如下:
-
000800048031000 2016121520161215PROD00000001300B80062122602000874285260000000003001561214230030296869ECC001 00000100003648031000 00031000 541177025509898110254114153TAIHE 000000000000000000000000000001871178801020000 01020000 003 1 00C000000000010 0000 000000016F4E7412ABAE096B072001601000C00000000000701FE33F0123456707010103900000010A010000004400307EC1DF 00137C00161214156Y100000000000300156 250940000000000000 26A000000333010101 003000000000ECC001 0000000048031000 0000000048031000 0000000048031000 0000000048031000 00000000 00000000 00000000 00000000 00000000 00000000 D0000000232 00000000 00000000 00000000 300B80062122602000874285260000000003001561214230029297435ECC001 00000100048348031000 00031000 541177025511898110254114153TAIHE 000000000000000000000000000001871177801020000 01020000 003 1 00C000000000010 0000 00000001F5BB5F8333526916072001601000C00000000000CDA9395D0123456707010103900000010A01000000410026DBE246 00157C00161214156Y100000000000300156 250940000000000000 26A000000333010101 003000000000ECC001 0000000048031000 0000000048031000 0000000048031000 0000000048031000 00000000 00000000 00000000 00000000 00000000 00000000 D0000000232 00000000 00000000 00000000 300B80062122602000874285260000000003001561214230027296115ECC001 00000100003548031000 00031000 541177025509898110254114153TAIHE 000000000000000000000000000001871176601020000 01020000 003 1 00C000000000010 0000 000000013DE0F72F2CDC1F3C072001601000C00000000000594D2B5E0123456707010103900000010A0100000047005A9114F1 00117C00161214156Y100000000000300156 250940000000000000 26A000000333010101 003000000000ECC001 0000000048031000 0000000048031000 0000000048031000 0000000048031000 00000000 00000000 00000000 00000000 00000000 00000000 D0000000232 00000000 00000000 00000000 300B80062122602000874285260000000003001561214230031296116ECC001 00000100048448031000 00031000 541177025511898110254114153TAIHE 000000000000000000000000000001871180601020000 01020000 003 1 00C000000000010 0000 00000001EA2BCC000C1DD14A072001601000C000000000002E0F242E0123456707010103900000010A010000003800187FFCA3 00177C00161214156Y100000000000300156 250940000000000000 26A000000333010101 003000000000ECC001 0000000048031000 0000000048031000 0000000048031000 0000000048031000 00000000 00000000 00000000 00000000 00000000 00000000 D0000000232 00000000 00000000 00000000 0018000000000000600000000000000000000000000000000
脚本如下:
-
#!/bin/env bash
-
-
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
-
-
mydate=$(date +'%y%m%d')
-
FILE=/user/INF${mydate}51B
-
LINE=`cat $FILE`
-
echo ${LINE:0:46}
-
echo ${LINE:46:-1} > userline
-
/usr/bin/awk -F '?' '{line="";for(i=0;i<=length($0);i++){line=substr($0,i,i+567);i=i+567; print line}}' userline
-
rm -rf userline
阅读(1449) | 评论(0) | 转发(0) |