0

I am trying to convert a pre-formatted section within a log file into a comma or tab delimited tabular view.

Here's a sample section contained in the log file:

Appliance-01> home
Appliance-01>  show debug lldp
logout

LLDP information:

  IfIdx 16 ("1/1/1") Information:
    Chassis ID:           XYZ0-ABCD-EFGH0(SWITCH01)
    System name:          XYZ0-ABCD-EFGH0(SWITCH01)
    System description:   SOME-SWITCH
    Software version:     Cisco OS
    Platform:             
    Port ID:              Ethernet1/40
    Port description:     Ethernet1/40
    Management address:   10.20.30.41
    Time to live:         180s (170s remaining)

  IfIdx 17 ("1/1/2") Information:
    Chassis ID:           XYZ0-ABCD-EFGH0(SWITCH02)
    System name:          XYZ0-ABCD-EFGH0(SWITCH02)
    System description:   SOME-SWITCH
    Software version:     Cisco OS
    Platform:             
    Port ID:              Ethernet1/40
    Port description:     Ethernet1/40
    Management address:   10.20.30.42
    Time to live:         180s (170s remaining)

I would like this to look like this:

Appliance Name, Interface, Chassis ID, System name, Port ID, Port Desc, Mgmt addr
Appliance-01, IfIdx 16 ("1/1/1"), XYZ0-ABCD-EFGH0(SWITCH01), XYZ0-ABCD-EFGH0(SWITCH01), Ethernet1/40, Ethernet1/40, 10.20.30.41
Appliance-01, IfIdx 17 ("1/1/2"), XYZ0-ABCD-EFGH0(SWITCH02), XYZ0-ABCD-EFGH0(SWITCH02), Ethernet1/40, Ethernet1/40, 10.20.30.42

And then eventually utilize the same script to parse through a large number of log files and produce a much larger output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.