Create csv from console output

This topic contains 2 replies, has 3 voices, and was last updated by  Olaf Soyk 3 weeks, 2 days ago.

  • Author
    Posts
  • #84779

    mattew
    Participant

    Hi all,
    it's my first post in this forum, but I have read more topic where I have found great indication and suggestion.

    Now I have the first problem with powershell,
    I have a startup (configuration file) of a router,
    I would like to extract in a csv file information about the interfaces.

    ....
    ....
    interface gpon-olt_1/3/4
      onu 1 type pippo pw 12345678
      onu 1 profile line 20M remote 110
      onu 2 type pippo pw 12345679
      onu 2 profile line 20M remote 110
      onu 3 type pippo pw 12345680
      onu 3 profile line 20M remote 110
      onu 4 type pippo pw 12345681
      onu 4 profile line 20M remote 110
    !
    interface gpon-olt_1/3/5
      onu 1 type pippo pw 12345682
      onu 1 profile line 20M remote 110
      onu 2 type pippo pw 12345683
      onu 2 profile line 20M remote 110
      onu 3 type pippo pw 12345684
      onu 3 profile line 20M remote 110
      onu 4 type pippo pw 12345685
      onu 4 profile line 20M remote 110
    ....
    ....
    ....

    I would like to have this result:

    interface	Onu	type	pw
    gpon-olt_1/3/4	1	pippo	12345678
    gpon-olt_1/3/4	2	pippo	12345679
    gpon-olt_1/3/4	3	pippo	12345680
    gpon-olt_1/3/4	4	pippo	12345681
    gpon-olt_1/3/5	1	pippo	12345682
    gpon-olt_1/3/5	2	pippo	12345683
    gpon-olt_1/3/5	3	pippo	12345684
    gpon-olt_1/3/5	4	pippo	12345685
    

    thanks all

  • #84890

    Curtis Smith
    Participant

    What is your problem? What have you tried? What is not working?

  • #84893

    Olaf Soyk
    Participant

    The following video might help you understand a little more:

    Sophisitcated Techniques of Plain Text Parsing

You must be logged in to reply to this topic.