文本文件a.txt的处理(200分)

  • 主题发起人 主题发起人 halei
  • 开始时间 开始时间
H

halei

Unregistered / Unconfirmed
GUEST, unregistred user!
a.txt的内容如下:
Thu Oct 31 15:06:37 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=22"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006131"
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Acct-Session-Time = 0
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036047997
Request-Authenticator = Verified

Thu Oct 31 15:06:37 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:30.636 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:30.636 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=22"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006132"
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Acct-Session-Time = 0
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036047997
Request-Authenticator = Verified

Thu Oct 31 15:06:37 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.640 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:30.640 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:30.640 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=22"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006133"
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Acct-Session-Time = 0
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036047997
Request-Authenticator = Verified

Thu Oct 31 15:06:57 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L25:h323-call-origin=answer"
Vendor-Specific = "V9:T27:L21:h323-call-type=VoIP"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.628 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:35.102 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:49.952 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=10"
Vendor-Specific = "V9:T23:L32:h323-remote-address=210.5.4.81"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006130"
Acct-Input-Octets = 11784
Acct-Output-Octets = 11762
Acct-Input-Packets = 491
Acct-Output-Packets = 492
Acct-Session-Time = 15
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036048017
Request-Authenticator = Verified

Thu Oct 31 15:06:57 2002
NAS-IP-Address = 210.5.8.166
[root@OPTRA01 optvoip01]# ls
20021026.detail 20021101.detail 20021105.detail 20021107.detail 20021109.detail detail SessionData
20021031.detail 20021102.detail 20021106.detail 20021108.detail atdetail rp
[root@OPTRA01 optvoip01]# more 20021101.detail
Thu Oct 31 15:06:37 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=22"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006131"
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Acct-Session-Time = 0
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036047997
Request-Authenticator = Verified

Thu Oct 31 15:06:37 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.632 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:30.636 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:30.636 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=22"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006132"
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Acct-Session-Time = 0
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036047997
Request-Authenticator = Verified

Thu Oct 31 15:06:37 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.640 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:30.640 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:30.640 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=22"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006133"
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Acct-Session-Time = 0
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036047997
Request-Authenticator = Verified

Thu Oct 31 15:06:57 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "optidc@optisp.com"
Called-Station-Id = "38486688008521000"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:30.680 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:35.104 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:35:49.964 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=10"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=56343434 34EF3F00 2B211E98 BD537F45"
Acct-Session-Id = "00006134"
Acct-Input-Octets = 17594
Acct-Output-Octets = 5952
Acct-Input-Packets = 492
Acct-Output-Packets = 491
Acct-Session-Time = 15
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036048017
Request-Authenticator = Verified

Thu Oct 31 15:07:39 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "101"
Called-Station-Id = "3848668807563392103"
Calling-Station-Id = "101"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=00040F00 33390212 85EC4BCC 1AE233DC"
Vendor-Specific = "V9:T26:L25:h323-call-origin=answer"
Vendor-Specific = "V9:T27:L21:h323-call-type=VoIP"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:33.924 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:41.284 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:36:31.824 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=10"
Vendor-Specific = "V9:T23:L33:h323-remote-address=210.5.8.119"
Vendor-Specific = "V9:T31:L23:h323-voice-quality=21"
Vendor-Specific = "V9:T24:L50:h323-conf-id=00040F00 33390212 85EC4BCC 1AE233DC"
Acct-Session-Id = "00006135"
Acct-Input-Octets = 40788
Acct-Output-Octets = 37353
Acct-Input-Packets = 1591
Acct-Output-Packets = 1918
Acct-Session-Time = 51
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036048059
Request-Authenticator = Verified

Thu Oct 31 15:07:39 2002
NAS-IP-Address = 210.5.8.166
NAS-Port-Type = Async
User-Name = "101"
Called-Station-Id = "3848668807563392103"
Calling-Station-Id = "101"
Acct-Status-Type = Stop
Service-Type = 12
Vendor-Specific = "V9:T33:L20:h323-gw-id=Router."
Vendor-Specific = "V9:T1:L59:h323-incoming-conf-id=00040F00 33390212 85EC4BCC 1AE233DC"
Vendor-Specific = "V9:T26:L28:h323-call-origin=originate"
Vendor-Specific = "V9:T27:L26:h323-call-type=Telephony"
Vendor-Specific = "V9:T25:L50:h323-setup-time=*22:35:33.972 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T28:L52:h323-connect-time=*22:35:41.286 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T29:L55:h323-disconnect-time=*22:36:31.836 UTC Thu Jan 6 2000"
Vendor-Specific = "V9:T30:L26:h323-disconnect-cause=10"
Vendor-Specific = "V9:T31:L22:h323-voice-quality=0"
Vendor-Specific = "V9:T24:L50:h323-conf-id=00040F00 33390212 85EC4BCC 1AE233DC"
Acct-Session-Id = "00006136"
Acct-Input-Octets = 59361
Acct-Output-Octets = 18780
Acct-Input-Packets = 1918
Acct-Output-Packets = 1591
Acct-Session-Time = 51
Acct-Delay-Time = 0
Client-IP-Address = 210.5.8.166
Timestamp = 1036048059
Request-Authenticator = Verified


请问怎样处理使每段第12行为Vendor-Specific = "V9:T27:L21:h323-call-type=VoIP"那一段
能够输入到另一个文件中,
格式为:
date;User-Name;Called-Station-Id;Acct-Session-Time;Timestamp;Acct-Session-Id;
Oct 31 15:06:37 2002;optidc@optisp.com;38486688008521000;15;1036048017;00006130
Oct 31 15:07:39 2002;101;3848668807563392103;51;1036048059;00006135



 
找到规律,写个循环不就成了。
 
把它改成INI文件就行了
 
后退
顶部