vendredi 16 janvier 2015

Help with Script to Process txt file to CSV


I am trying/attempting to write a script to turn this:



Mikrotik01#show unique routing entry | 192.168.255.232 | inc ID
Thu June 10 15:21:32.808 CST
Unique Entry: 192.168.255.21
Unique Entry: 192.168.255.233
Unique Entry: 192.168.255.155
Mikrotik01#show unique routing entry | 192.168.255.233 | inc ID
Thu June 10 15:21:33.079 CST
Unique Entry: 192.168.255.234
Unique Entry: 192.168.255.232
Mikrotik01#show unique routing entry | 192.168.255.234 | inc ID
Thu June 10 15:21:33.347 CST
Unique Entry: 192.168.255.233
Unique Entry: 192.168.255.235


Into a CSV that contains:



192.168.255.232,192.168.255.21,192.168.255.233,192.168.255.155
192.168.255.233,192.168.255.234,192.168.255.232
192.168.255.234,192.168.255.233,192.168.255.235


Basically it will start a new row with the first line then add each of the neighboring router ID on the same line with a comma until it reaches the next line that contains the "Mikrotik" hostname where it would create a new line and continue through the whole file. End result in a csv.


I have been looking at it all day and I am just stuck. Any suggestions would be great and very much appreciated. Even a hint in the right direction.



Aucun commentaire:

Enregistrer un commentaire