Chinaunix首页 | 论坛 | 博客
  • 博客访问: 140603
  • 博文数量: 31
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 309
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-06 11:27
个人简介

开启暴走模式。

文章分类

全部博文(31)

文章存档

2017年(19)

2016年(1)

2015年(11)

我的朋友

分类: LINUX

2017-02-28 14:08:34

如题: 打印前46个字符,后面按567个字符为一次交易 
文本文件如下:

点击(此处)折叠或打开

  1. 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

脚本如下:

点击(此处)折叠或打开

  1. #!/bin/env bash
  2. export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
  3. mydate=$(date +'%y%m%d')
  4. FILE=/user/INF${mydate}51B
  5. LINE=`cat $FILE`
  6. echo ${LINE:0:46}
  7. echo ${LINE:46:-1} > userline
  8. /usr/bin/awk -F '?' '{line="";for(i=0;i<=length($0);i++){line=substr($0,i,i+567);i=i+567; print line}}' userline
  9. rm -rf userline


阅读(1440) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~