psychosb
Technical User
- Oct 19, 2011
- 3
Hello there!
I'm wondering if anyone can help me with this little (big) challenge!
I have a file, with about 30 blocks, each one with the same structure as the following:
---
Timestamp: 14:52:50
+++++ STCP DEVICE METERS +++++
netstat -interface #sdlmux.m5.13.1.0
MAC Type : CSMA/CD
MAC Address: 00:00:a8:43:3f:cd
Device Name: #sdlmux.m5.13.1.0
Line Speed : 100 mb/s
Line Duplex: Full-Duplex
MAC Statistics:
Received frames : 3066396
Received multicast and broadcast frames : 102
Received octets : 813041981
Transmitted frames : 3430870
Transmitted octets : 1220638884
LAN Chipset re-initialized : 0
SQE error : 0
Transmit ring full : 0
Transmit frame discarded, late collisions: 0
Transmit frame was deferred : 0
Transmit frame after a single retry : 0
Transmit frame after multiple retry : 0
Transmit frame discarded, excessive retry: 0
Receive frame discarded, lack of buffers : 0
Receive frame discarded, improper framing: 0
Receive frame discarded, an overflow : 0
Receive frame discarded, bad CRC : 0
Receive frame discarded, bad address : 0
Receive frame discarded, congestion : 0
MAC Summary:
Transmitted frames : 3430870
Transmitted octets : 1220638884
Retransmitted frames : 0
Received frames : 3066498
Received octets : 813041981
Total of lost frames : 0
ready 18:52:49
***** END OF RECORD *****
I'm wondering if there's a way to use AWK (and SED) to get the values above in red, and put them in a line, separated with comma... like this:
Timestamp , device_name , received_frame , received_multicast , received_octets , transmitted_frames , transmitted_octets , Receive_frame_bad_crc
This is getting me nuts. I have to get the line for every block in the text file, and I can't use the awk to get the column values, because it's not allways the same.
Anyone can help me?
Thanks!!!
I'm wondering if anyone can help me with this little (big) challenge!
I have a file, with about 30 blocks, each one with the same structure as the following:
---
Timestamp: 14:52:50
+++++ STCP DEVICE METERS +++++
netstat -interface #sdlmux.m5.13.1.0
MAC Type : CSMA/CD
MAC Address: 00:00:a8:43:3f:cd
Device Name: #sdlmux.m5.13.1.0
Line Speed : 100 mb/s
Line Duplex: Full-Duplex
MAC Statistics:
Received frames : 3066396
Received multicast and broadcast frames : 102
Received octets : 813041981
Transmitted frames : 3430870
Transmitted octets : 1220638884
LAN Chipset re-initialized : 0
SQE error : 0
Transmit ring full : 0
Transmit frame discarded, late collisions: 0
Transmit frame was deferred : 0
Transmit frame after a single retry : 0
Transmit frame after multiple retry : 0
Transmit frame discarded, excessive retry: 0
Receive frame discarded, lack of buffers : 0
Receive frame discarded, improper framing: 0
Receive frame discarded, an overflow : 0
Receive frame discarded, bad CRC : 0
Receive frame discarded, bad address : 0
Receive frame discarded, congestion : 0
MAC Summary:
Transmitted frames : 3430870
Transmitted octets : 1220638884
Retransmitted frames : 0
Received frames : 3066498
Received octets : 813041981
Total of lost frames : 0
ready 18:52:49
***** END OF RECORD *****
I'm wondering if there's a way to use AWK (and SED) to get the values above in red, and put them in a line, separated with comma... like this:
Timestamp , device_name , received_frame , received_multicast , received_octets , transmitted_frames , transmitted_octets , Receive_frame_bad_crc
This is getting me nuts. I have to get the line for every block in the text file, and I can't use the awk to get the column values, because it's not allways the same.
Anyone can help me?
Thanks!!!