Extract data from radius's raw data 
Author Message
 Extract data from radius's raw data

HI ;
    I have a row data which was extract from radius server . As look at the
raw data as below , one record has multiple lines .

I would like to use awk to extract those interested fields
(UserName,Calling-Station-Id, Acct-Session-Time) and  combine those fields
into a single line per record .
The structure of the summary data I required should look like this ..."

SUMMARY DATA
------------------------
7413484,007861062612931,100
1515726,8394749844,10
373734,29836474,50
"

How do I write a awk script to meet my such requirement ? I have no problem
by using perl script. Can I use awk to do that as well ?Please advise ...

Fri Nov 16 14:18:53 2001
        NAS-IP-Address = 172.16.2.11
        NAS-Port-Type = Async
        User-Name = "7413484"
        Called-Station-Id = "007861062612931"
        Calling-Station-Id = "7413484"
        Acct-Status-Type = Stop
        Service-Type = Login-User
        h323-gw-id = "h323-gw-id=SIN-GW5.pinnz.com"
        h323-conf-id = "h323-conf-id=28EF2944 59735F63 0 2A3D97B4"
        Cisco-AVPair = "h323-incoming-conf-id=28EF2944 59735F63 0 2A3D97B4"
        h323-call-origin = "h323-call-origin=originate"
        h323-call-type = "h323-call-type=VoIP"
        h323-setup-time = "h323-setup-time=.14:21:14.631 SG Fri Nov 16 2001"
        h323-connect-time = "h323-connect-time=.14:21:25.842 SG Fri Nov 16
2001"
        h323-disconnect-time = "h323-disconnect-time=.14:21:34.982 SG Fri
Nov 16 2001"
        h323-disconnect-cause = "h323-disconnect-cause=10"
        h323-voice-quality = "h323-voice-quality=0"
        h323-remote-address = "h323-remote-address=172.17.4.24"
        Acct-Session-Id = "00000629"
        Acct-Input-Octets = 5118
        Acct-Output-Octets = 5188
        Acct-Input-Packets = 114
        Acct-Output-Packets = 113
        Acct-Session-Time = 9
        Cisco-AVPair = "subscriber=RegularLine"
        Cisco-AVPair = "pre-bytes-in=0"
        Cisco-AVPair = "pre-bytes-out=0"
        Cisco-AVPair = "pre-paks-in=0"
        Cisco-AVPair = "pre-paks-out=0"
        Cisco-AVPair = "nas-rx-speed=0"
        Cisco-AVPair = "nas-tx-speed=0"
        Acct-Delay-Time = 0
        Client-IP-Address = 172.16.2.11
        Timestamp = 1005891533
        Request-Authenticator = None

Fri Nov 16 14:18:53 2001
        NAS-IP-Address = 172.16.2.11
        Cisco-NAS-Port = "ISDN 0:D:1"
        NAS-Port-Type = Async
        User-Name = "7413484"
        Called-Station-Id = "007861062612931"
        Calling-Station-Id = "7413484"
        Acct-Status-Type = Stop
        Service-Type = Login-User
        h323-gw-id = "h323-gw-id=SIN-GW5.pinnz.com"
        h323-conf-id = "h323-conf-id=28EF2944 59735F63 0 2A3D97B4"
        Cisco-AVPair = "h323-incoming-conf-id=28EF2944 59735F63 0 2A3D97B4"
        h323-call-origin = "h323-call-origin=answer"
        h323-call-type = "h323-call-type=Telephony"
        h323-setup-time = "h323-setup-time=.14:21:14.619 SG Fri Nov 16 2001"
        h323-connect-time = "h323-connect-time=.14:21:25.834 SG Fri Nov 16
2001"
        h323-disconnect-time = "h323-disconnect-time=.14:21:34.994 SG Fri
Nov 16 2001"
        h323-disconnect-cause = "h323-disconnect-cause=10"
        h323-voice-quality = "h323-voice-quality=0"
        Acct-Session-Id = "00000628"
        Acct-Input-Octets = 10257
        Acct-Output-Octets = 4590
        Acct-Input-Packets = 225
        Acct-Output-Packets = 103
        Acct-Session-Time = 9
        Cisco-AVPair = "subscriber=RegularLine"
        Cisco-AVPair = "h323-ivr-out=Tariff:Unknown"
        Cisco-AVPair = "pre-bytes-in=0"
        Cisco-AVPair = "pre-bytes-out=0"
        Cisco-AVPair = "pre-paks-in=0"
        Cisco-AVPair = "pre-paks-out=0"
        Cisco-AVPair = "nas-rx-speed=0"
        Cisco-AVPair = "nas-tx-speed=0"
        Acct-Delay-Time = 0
        Client-IP-Address = 172.16.2.11
        Timestamp = 1005891533
        Request-Authenticator = None

Fri Nov 16 14:23:03 2001
        NAS-IP-Address = 172.16.2.11
        NAS-Port-Type = Async
        User-Name = "151565"
        Called-Station-Id = "007865914341569"
        Calling-Station-Id = "151565"
        Acct-Status-Type = Stop
        Service-Type = Login-User
        h323-gw-id = "h323-gw-id=SIN-GW5.pinnz.com"
        h323-conf-id = "h323-conf-id=28EF2944 59735F6B 0 2A40E6F0"
        Cisco-AVPair = "h323-incoming-conf-id=28EF2944 59735F6B 0 2A40E6F0"
        h323-call-origin = "h323-call-origin=originate"
        h323-call-type = "h323-call-type=VoIP"
        h323-setup-time = "h323-setup-time=.14:24:51.754 SG Fri Nov 16 2001"
        h323-connect-time = "h323-connect-time=.14:25:45.601 SG Fri Nov 16
2001"
        h323-disconnect-time = "h323-disconnect-time=.14:25:45.601 SG Fri
Nov 16 2001"
        h323-disconnect-cause = "h323-disconnect-cause=10"
        h323-voice-quality = "h323-voice-quality=0"
        h323-remote-address = "h323-remote-address=172.17.4.24"
        Acct-Session-Id = "0000062D"
        Acct-Input-Octets = 11747
        Acct-Output-Octets = 0
        Acct-Input-Packets = 257
        Acct-Output-Packets = 0
        Acct-Session-Time = 0
        Cisco-AVPair = "subscriber=RegularLine"
        Cisco-AVPair = "pre-bytes-in=0"
        Cisco-AVPair = "pre-bytes-out=0"
        Cisco-AVPair = "pre-paks-in=0"
        Cisco-AVPair = "pre-paks-out=0"
        Cisco-AVPair = "nas-rx-speed=0"
        Cisco-AVPair = "nas-tx-speed=0"
        Acct-Delay-Time = 0
        Client-IP-Address = 172.16.2.11
        Timestamp = 1005891783
        Request-Authenticator = None

Fri Nov 16 14:23:03 2001
        NAS-IP-Address = 172.16.2.11
        Cisco-NAS-Port = "ISDN 0:D:1"
        NAS-Port-Type = Async
        User-Name = "151565"
        Called-Station-Id = "007865914341569"
        Calling-Station-Id = "151565"
        Acct-Status-Type = Stop
        Service-Type = Login-User
        h323-gw-id = "h323-gw-id=SIN-GW5.pinnz.com"
        h323-conf-id = "h323-conf-id=28EF2944 59735F6B 0 2A40E6F0"
        Cisco-AVPair = "h323-incoming-conf-id=28EF2944 59735F6B 0 2A40E6F0"
        h323-call-origin = "h323-call-origin=answer"
        h323-call-type = "h323-call-type=Telephony"
        h323-setup-time = "h323-setup-time=.14:24:51.742 SG Fri Nov 16 2001"
        h323-connect-time = "h323-connect-time=.14:25:45.609 SG Fri Nov 16
2001"
        h323-disconnect-time = "h323-disconnect-time=.14:25:45.609 SG Fri
Nov 16 2001"
        h323-disconnect-cause = "h323-disconnect-cause=10"
        h323-voice-quality = "h323-voice-quality=0"
        Acct-Session-Id = "0000062C"
        Acct-Input-Octets = 35583
        Acct-Output-Octets = 11219
        Acct-Input-Packets = 761
        Acct-Output-Packets = 246
        Acct-Session-Time = 0
        Cisco-AVPair = "subscriber=RegularLine"
        Cisco-AVPair = "h323-ivr-out=Tariff:Unknown"
        Cisco-AVPair = "pre-bytes-in=0"
        Cisco-AVPair = "pre-bytes-out=0"
        Cisco-AVPair = "pre-paks-in=0"
        Cisco-AVPair = "pre-paks-out=0"
        Cisco-AVPair = "nas-rx-speed=0"
        Cisco-AVPair = "nas-tx-speed=0"
        Acct-Delay-Time = 0
        Client-IP-Address = 172.16.2.11
        Timestamp = 1005891783
        Request-Authenticator = None

Fri Nov 16 14:23:41 2001
        NAS-IP-Address = 172.16.2.11
        NAS-Port-Type = Async
        User-Name = "151565"
        Called-Station-Id = "007862163550816"
        Calling-Station-Id = "151565"
        Acct-Status-Type = Stop
        Service-Type = Login-User
        h323-gw-id = "h323-gw-id=SIN-GW5.pinnz.com"
        h323-conf-id = "h323-conf-id=28EF2944 59735F67 0 2A3ED2DC"
        Cisco-AVPair = "h323-incoming-conf-id=28EF2944 59735F67 0 2A3ED2DC"
        h323-call-origin = "h323-call-origin=originate"
        h323-call-type = "h323-call-type=VoIP"
        h323-setup-time = "h323-setup-time=.14:22:35.306 SG Fri Nov 16 2001"
        h323-connect-time = "h323-connect-time=.14:22:42.781 SG Fri Nov 16
2001"
        h323-disconnect-time = "h323-disconnect-time=.14:26:23.141 SG Fri
Nov 16 2001"
        h323-disconnect-cause = "h323-disconnect-cause=10"
        h323-voice-quality = "h323-voice-quality=45"
        h323-remote-address = "h323-remote-address=172.17.4.24"
        Acct-Session-Id = "0000062B"
        Acct-Input-Octets = 75149
        Acct-Output-Octets = 78642
        Acct-Input-Packets = 1692
        Acct-Output-Packets = 1722
        Acct-Session-Time = 220
        Cisco-AVPair = "subscriber=RegularLine"
        Cisco-AVPair = "pre-bytes-in=0"
        Cisco-AVPair = "pre-bytes-out=0"
        Cisco-AVPair = "pre-paks-in=0"
        Cisco-AVPair = "pre-paks-out=0"
        Cisco-AVPair = "nas-rx-speed=0"
        Cisco-AVPair = "nas-tx-speed=0"
        Acct-Delay-Time = 0
        Client-IP-Address = 172.16.2.11
        Timestamp = 1005891821
        Request-Authenticator = None

Fri Nov 16 14:23:41 2001
        NAS-IP-Address = 172.16.2.11
        Cisco-NAS-Port = "ISDN 0:D:2"
        NAS-Port-Type = Async
        User-Name = "151565"
        Called-Station-Id = "007862163550816"
        Calling-Station-Id = "151565"
        Acct-Status-Type = Stop
        Service-Type = Login-User
        h323-gw-id = "h323-gw-id=SIN-GW5.pinnz.com"
        h323-conf-id = "h323-conf-id=28EF2944 59735F67 0 2A3ED2DC"
        Cisco-AVPair = "h323-incoming-conf-id=28EF2944 59735F67 0 2A3ED2DC"
        h323-call-origin = "h323-call-origin=answer"
        h323-call-type = "h323-call-type=Telephony"
        h323-setup-time = "h323-setup-time=.14:22:35.298 SG Fri Nov 16 2001"
        h323-connect-time = "h323-connect-time=.14:22:42.777 SG Fri Nov 16
2001"
        h323-disconnect-time = "h323-disconnect-time=.14:26:23.157 SG Fri
Nov 16 2001"
        h323-disconnect-cause = "h323-disconnect-cause=10"
        h323-voice-quality = "h323-voice-quality=0"
        Acct-Session-Id = "0000062A"
        Acct-Input-Octets = 80588
        Acct-Output-Octets = 74621
        Acct-Input-Packets = 1765
        Acct-Output-Packets = 1681
        Acct-Session-Time = 220
        Cisco-AVPair = "subscriber=RegularLine"
...

read more »



Fri, 14 May 2004 03:19:50 GMT  
 Extract data from radius's raw data

November 2001 20:19:

Quote:
> HI ;
>     I have a row data which was extract from radius server . As look
>     at the
> raw data as below , one record has multiple lines .

> I would like to use awk to extract those interested fields
> (UserName,Calling-Station-Id, Acct-Session-Time) and  combine those
> fields into a single line per record .
> The structure of the summary data I required should look like this
> ..."

> SUMMARY DATA
> ------------------------
> 7413484,007861062612931,100
> 1515726,8394749844,10

Where do you get 8394749844,100 it's not in the data you provide?

Quote:
> 373734,29836474,50
> "

> How do I write a awk script to meet my such requirement ? I have no
> problem by using perl script. Can I use awk to do that as well
> ?Please advise ...

[SNIP]

What about if you explain where you want to get those numbers not in
the data and show us how you did it with perl?

Michael Heiming



Fri, 14 May 2004 00:00:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Outputting 'Raw' printer data

2. PyObject *data - access to raw data?

3. Extracting data from COBOL data files

4. Can't seem to extract data from this ASCII file

5. data socket error: Can't connect to Data

6. Raw data from the Aus Stocks

7. Eiffel and "raw" data storage

8. USPS/UPS/etc shipping rate raw data...

9. I just want the raw data...

10. newbie:displaying raw binary data

11. Variable length raw-byte data

12. Attempting to read variable length records as raw data

 

 
Powered by phpBB® Forum Software