1. perl 改变行分割符
local $/="
";
2.
2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.FlowLogService:1295] - 流水服务 花费时间为: 0毫秒
2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [DEBUG] [com.dc.esb.container.adaptor.frame.SynFrameRunnable:370] - Frame is now invoking service <UnPackerStand>
2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:63] - 基础服务[UnPackerStand]开始执行
2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:128] - ***********protocalName=
TLESBSimTCPChannelConnector
2018-09-17 07:32:49,047 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:140] - 原始报文= :
[<?xml version="1.0" encoding="UTF-8"?><SERVICE><SYS_HEAD><USER_ID>013555</USER_ID><TRAN_TIMESTAMP>073249039</TRAN_TIMESTAMP><AUTH_USER_ID_ARRAY><AUTH_CHECK_FLAG></AUTH_CHECK_FLAG><AUTH_CHECK_MSG></AUTH_CHECK_MSG><AUTH_USER_ID></AUTH_USER_ID></AUTH_USER_ID_ARRAY><BRANCH_ID>330901100</BRANCH_ID><TRAN_DATE>20180917</TRAN_DATE><ORG_SYS_ID>101020</ORG_SYS_ID><SOURCE_TYPE>A01</SOURCE_TYPE><PROVIDER_ID>301020</PROVIDER_ID><CONSUMER_SEQ_NO>10102020180917010156055012</CONSUMER_SEQ_NO><WS_ID>10.56.21.63</WS_ID><SERVICE_SCENE>01</SERVICE_SCENE><SERVICE_CODE>11003000065</SERVICE_CODE><CONSUMER_ID>101020</CONSUMER_ID><FILE_PATH></FILE_PATH></SYS_HEAD><APP_HEAD><CURRENT_NUM>0</CURRENT_NUM><WNDW_NO>0</WNDW_NO><CARD_SERIAL_NO></CARD_SERIAL_NO><REVERSAL_DATE></REVERSAL_DATE><BUSS_SEQ_NO>10102020180917010156055012</BUSS_SEQ_NO><TOTAL_NUM>14</TOTAL_NUM><TRACK2></TRACK2><TRAN_SCENE>0000000000</TRAN_SCENE><PGUP_OR_PGDN></PGUP_OR_PGDN><TRACK3></TRACK3><LKG_FLAG></LKG_FLAG><TOTAL_ROWS></TOTAL_ROWS><SEND_TRAN_CODE>4199</SEND_TRAN_CODE><PSWD_KEY_INDX></PSWD_KEY_INDX><PSWD_ECPTN_FLG></PSWD_ECPTN_FLG><WARN_CFM_FLAG></WARN_CFM_FLAG><AHR_MODE></AHR_MODE><CORP_CODE>9999</CORP_CODE><FEE_CFM_FLAG></FEE_CFM_FLAG><LKG_TRAN_CODE></LKG_TRAN_CODE><SEND_TRAN_NAME>柜员账务流水查询打印</SEND_TRAN_NAME><AUTH_CFM_FLAG></AUTH_CFM_FLAG><CHNL_FLG_STRG>10000000000000000000</CHNL_FLG_STRG><REVERSAL_SEQ_NO></REVERSAL_SEQ_NO><REVERSAL_TRAN_TYPE></REVERSAL_TRAN_TYPE></APP_HEAD><LOCAL_HEAD></LOCAL_HEAD><BODY><CCY></CCY><BUSINESS_BRANCH_ID>330901100</BUSINESS_BRANCH_ID><CURRENT_NUM>0</CURRENT_NUM><ORI_TRAN_DATE>20180916</ORI_TRAN_DATE><START_PAGE>1</START_PAGE><TOTAL_NUM>14</TOTAL_NUM><TELLER_NO>013555</TELLER_NO><END_SEQ_NO></END_SEQ_NO><QUERY_PRINT_FLAG>0</QUERY_PRINT_FLAG><START_SEQ_NO></START_SEQ_NO></BODY></SERVICE>]
2018-09-17 07:32:49,047 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:157] - 标准报文的拆包执行完毕!花费时间为: 1毫秒
2018-09-17 07:32:49,049 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.ConsumerClientService:157] - here is the CDVlaue before sendCompositeData {
"BODY" : CompositeData {
"CCY" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"BUSINESS_BRANCH_ID" : Field { type=FieldType[string] length=9 scale=0 pin=false value= {330901100} }
"CURRENT_NUM" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} }
"ORI_TRAN_DATE" : Field { type=FieldType[string] length=8 scale=0 pin=false value= {20180916} }
"START_PAGE" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {1} }
"TOTAL_NUM" : Field { type=FieldType[string] length=2 scale=0 pin=false value= {14} }
"TELLER_NO" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {013555} }
"END_SEQ_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"QUERY_PRINT_FLAG" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} }
"START_SEQ_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
}
"SYS_HEAD" : CompositeData {
"USER_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {013555} }
"TRAN_TIMESTAMP" : Field { type=FieldType[string] length=9 scale=0 pin=false value= {073249039} }
"AUTH_USER_ID_ARRAY" : Array [1] {
0 : CompositeData {
"AUTH_CHECK_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"AUTH_CHECK_MSG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"AUTH_USER_ID" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
}
}
"BRANCH_ID" : Field { type=FieldType[string] length=9 scale=0 pin=false value= {330901100} }
"TRAN_DATE" : Field { type=FieldType[string] length=8 scale=0 pin=false value= {20180917} }
"ORG_SYS_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {101020} }
"SOURCE_TYPE" : Field { type=FieldType[string] length=3 scale=0 pin=false value= {A01} }
"ESB_SEQ_NO" : Field { type=FieldType[string] length=26 scale=0 pin=false value= {50010120180917010000033779} }
"PROVIDER_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {301020} }
"CONSUMER_SEQ_NO" : Field { type=FieldType[string] length=26 scale=0 pin=false value= {10102020180917010156055012} }
"WS_ID" : Field { type=FieldType[string] length=11 scale=0 pin=false value= {10.56.21.63} }
"SERVICE_SCENE" : Field { type=FieldType[string] length=2 scale=0 pin=false value= {01} }
"SERVICE_CODE" : Field { type=FieldType[string] length=11 scale=0 pin=false value= {11003000065} }
"CONSUMER_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {101020} }
"FILE_PATH" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
}
"LOCAL_HEAD" : CompositeData {
}
"APP_HEAD" : CompositeData {
"CURRENT_NUM" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} }
"WNDW_NO" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} }
"CARD_SERIAL_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"REVERSAL_DATE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"BUSS_SEQ_NO" : Field { type=FieldType[string] length=26 scale=0 pin=false value= {10102020180917010156055012} }
"TOTAL_NUM" : Field { type=FieldType[string] length=2 scale=0 pin=false value= {14} }
"TRACK2" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"TRAN_SCENE" : Field { type=FieldType[string] length=10 scale=0 pin=false value= {0000000000} }
"PGUP_OR_PGDN" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"TRACK3" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"LKG_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"TOTAL_ROWS" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"SEND_TRAN_CODE" : Field { type=FieldType[string] length=4 scale=0 pin=false value= {4199} }
"PSWD_KEY_INDX" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"PSWD_ECPTN_FLG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"WARN_CFM_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"AHR_MODE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"CORP_CODE" : Field { type=FieldType[string] length=4 scale=0 pin=false value= {9999} }
"FEE_CFM_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"LKG_TRAN_CODE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"SEND_TRAN_NAME" : Field { type=FieldType[string] length=10 scale=0 pin=false value= {柜员账务流水查询打印} }
"AUTH_CFM_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"CHNL_FLG_STRG" : Field { type=FieldType[string] length=20 scale=0 pin=false value= {10000000000000000000} }
"REVERSAL_SEQ_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
"REVERSAL_TRAN_TYPE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} }
}
}
2018-09-17 07:32:49,049 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.ConsumerClientService:175] - ConsumerClientService设置的超时时间为[100000]
3.
20.5.101.31_/root>cat -n test.log.1
1 2018-
2 2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.FlowLogService:1295] - 流水服务 花费时间为: 0毫秒
3 2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [DEBUG] [com.dc.esb.container.adaptor.frame.SynFrameRunnable:370] - Frame is now invoking service <UnPackerStand>
4 2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:63] - 基础服务[UnPackerStand]开始执行
5 2018-09-17 07:32:49,046 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:128] - ***********protocalName= TLESBSimTCPChannelConnector
6 2018-09-17 07:32:49,047 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:140] - 原始报文= : [<?xml version="1.0" encoding="UTF-8"?><SERVICE><SYS_HEAD><USER_ID>013555</USER_ID><TRAN_TIMESTAMP>073249039</TRAN_TIMESTAMP><AUTH_USER_ID_ARRAY><AUTH_CHECK_FLAG></AUTH_CHECK_FLAG><AUTH_CHECK_MSG></AUTH_CHECK_MSG><AUTH_USER_ID></AUTH_USER_ID></AUTH_USER_ID_ARRAY><BRANCH_ID>330901100</BRANCH_ID><TRAN_DATE>20180917</TRAN_DATE><ORG_SYS_ID>101020</ORG_SYS_ID><SOURCE_TYPE>A01</SOURCE_TYPE><PROVIDER_ID>301020</PROVIDER_ID><CONSUMER_SEQ_NO>10102020180917010156055012</CONSUMER_SEQ_NO><WS_ID>10.56.21.63</WS_ID><SERVICE_SCENE>01</SERVICE_SCENE><SERVICE_CODE>11003000065</SERVICE_CODE><CONSUMER_ID>101020</CONSUMER_ID><FILE_PATH></FILE_PATH></SYS_HEAD><APP_HEAD><CURRENT_NUM>0</CURRENT_NUM><WNDW_NO>0</WNDW_NO><CARD_SERIAL_NO></CARD_SERIAL_NO><REVERSAL_DATE></REVERSAL_DATE><BUSS_SEQ_NO>10102020180917010156055012</BUSS_SEQ_NO><TOTAL_NUM>14</TOTAL_NUM><TRACK2></TRACK2><TRAN_SCENE>0000000000</TRAN_SCENE><PGUP_OR_PGDN></PGUP_OR_PGDN><TRACK3></TRACK3><LKG_FLAG></LKG_FLAG><TOTAL_ROWS></TOTAL_ROWS><SEND_TRAN_CODE>4199</SEND_TRAN_CODE><PSWD_KEY_INDX></PSWD_KEY_INDX><PSWD_ECPTN_FLG></PSWD_ECPTN_FLG><WARN_CFM_FLAG></WARN_CFM_FLAG><AHR_MODE></AHR_MODE><CORP_CODE>9999</CORP_CODE><FEE_CFM_FLAG></FEE_CFM_FLAG><LKG_TRAN_CODE></LKG_TRAN_CODE><SEND_TRAN_NAME>柜员账务流水查询打印</SEND_TRAN_NAME><AUTH_CFM_FLAG></AUTH_CFM_FLAG><CHNL_FLG_STRG>10000000000000000000</CHNL_FLG_STRG><REVERSAL_SEQ_NO></REVERSAL_SEQ_NO><REVERSAL_TRAN_TYPE></REVERSAL_TRAN_TYPE></APP_HEAD><LOCAL_HEAD></LOCAL_HEAD><BODY><CCY></CCY><BUSINESS_BRANCH_ID>330901100</BUSINESS_BRANCH_ID><CURRENT_NUM>0</CURRENT_NUM><ORI_TRAN_DATE>20180916</ORI_TRAN_DATE><START_PAGE>1</START_PAGE><TOTAL_NUM>14</TOTAL_NUM><TELLER_NO>013555</TELLER_NO><END_SEQ_NO></END_SEQ_NO><QUERY_PRINT_FLAG>0</QUERY_PRINT_FLAG><START_SEQ_NO></START_SEQ_NO></BODY></SERVICE>]
7 2018-09-17 07:32:49,047 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.UnPackerStand:157] - 标准报文的拆包执行完毕!花费时间为: 1毫秒
8 2018-09-17 07:32:49,049 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.ConsumerClientService:157] - here is the CDVlaue before sendCompositeData { "BODY" : CompositeData { "CCY" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "BUSINESS_BRANCH_ID" : Field { type=FieldType[string] length=9 scale=0 pin=false value= {330901100} } "CURRENT_NUM" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} } "ORI_TRAN_DATE" : Field { type=FieldType[string] length=8 scale=0 pin=false value= {20180916} } "START_PAGE" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {1} } "TOTAL_NUM" : Field { type=FieldType[string] length=2 scale=0 pin=false value= {14} } "TELLER_NO" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {013555} } "END_SEQ_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "QUERY_PRINT_FLAG" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} } "START_SEQ_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } } "SYS_HEAD" : CompositeData { "USER_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {013555} } "TRAN_TIMESTAMP" : Field { type=FieldType[string] length=9 scale=0 pin=false value= {073249039} } "AUTH_USER_ID_ARRAY: Array [1] { 0 : CompositeData { "AUTH_CHECK_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "AUTH_CHECK_MSG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "AUTH_USER_ID" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } } } "BRANCH_ID" : Field { type=FieldType[string] length=9 scale=0 pin=false value= {330901100} } "TRAN_DATE" : Field { type=FieldType[string] length=8 scale=0 pin=false value= {20180917} } "ORG_SYS_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {101020} } "SOURCE_TYPE" : Field { type=FieldType[string] length=3 scale=0 pin=false value= {A01} } "ESB_SEQ_NO" : Field { type=FieldType[string] length=26 scale=0 pin=false value= {50010120180917010000033779} } "PROVIDER_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {301020} } "CONSUMER_SEQ_NO" : Field { type=FieldType[string] length=26 scale=0 pin=false value= {10102020180917010156055012} } "WS_ID" : Field { type=FieldType[string] length=11 scale=0 pin=false value= {10.56.21.63} } "SERVICE_SCENE" : Field { type=FieldType[string] length=2 scale=0 pin=false value= {01} } "SERVICE_CODE" : Field { type=FieldType[string] length=11 scale=0 pin=false value= {11003000065} } "CONSUMER_ID" : Field { type=FieldType[string] length=6 scale=0 pin=false value= {101020} } "FILE_PATH" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } } "LOCAL_HEAD" : CompositeData { } "APP_HEAD" : CompositeData { "CURRENT_NUM" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} } "WNDW_NO" : Field { type=FieldType[string] length=1 scale=0 pin=false value= {0} } "CARD_SERIAL_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "REVERSAL_DATE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "BUSS_SEQ_NO" : Field { type=FieldType[string] length=26 scale=0 pin=false value= {10102020180917010156055012} } "TOTAL_NUM" : Field { type=FieldType[string] length=2 scale=0 pin=false value= {14} } "TRACK2" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "TRAN_SCENE" : Field { type=FieldType[string] length=10 scale=0 pin=false value= {0000000000} } "PGUP_OR_PGDN" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "TRACK3" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "LKG_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "TOTAL_ROWS" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "SEND_TRAN_CODE" : Field { type=FieldType[string] length=4 scale=0 pin=false value= {4199} } "PSWD_KEY_INDX" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "PSWD_ECPTN_FLG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "WARN_CFM_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "AHR_MODE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "CORP_CODE" : Field { type=FieldType[string] length=4 scale=0 pin=false value= {9999} } "FEE_CFM_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "LKG_TRAN_CODE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "SEND_TRAN_NAME" : Field { type=FieldType[string] length=10 scale=0 pin=false value= {柜员账务流水查询打印} } "AUTH_CFM_FLAG" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "CHNL_FLG_STRG" : Field { type=FieldType[string] length=20 scale=0 pin=false value= {10000000000000000000} } "REVERSAL_SEQ_NO" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } "REVERSAL_TRAN_TYPE" : Field { type=FieldType[string] length=0 scale=0 pin=false value= {} } } }
9 2018-09-17 07:32:49,049 [esbapp1-esb_in-20180917073249-183326] [pool-5-thread-1231] [INFO] [com.dcits.esb.baseservice.ConsumerClientService:175] - ConsumerClientService设置的超时时间为[100000]
You have mail in /var/spool/mail/root
4.
20.5.101.31_/root>cat a2.pl
use Encode;
local $/="2018-";
open (B,"<","test.log");
while (<B>){
#sleep 2;
$_=~ s/[
]/ /g;
$_=~ s#$/$##g;
open DATAFH,">>test.log.1" || die "open file failed:$!";
print DATAFH ($/.$_)."
";
};
close B;