dlal66 has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I am stuck with the following situation. I am sending a command to an equipment and I am getting the following output (multi line string). Please note that each line is indented as it is shown below:
Each line that begins with ^MAC Address: is a node and I want to parse the lines so that relevant information relating to the node can be stored in a structure. e.g. In the above example, I have two nodes. Preferably, I am trying to have as output all information belonging to each node printed. e.g.MAC Address: xx:aa:aa:aa:aa:aa IP addr: a.b.c.d x.y.z.f Name: xxxx Neighbors attached: 1 Additional: xxx Interface: xxx Index: xxx Link Cost: xx Link Speed: xx Mbps MAC Address: xx:aa:aa:aa:aa:aa IP addr: a.b.c.d x.y.z.f Name: xxxx Neighbors attached: 1 Additional: xxx Interface: xxx Index: xxx Link Cost: xx Link Speed: xx Mbps
Thanks in advance....Node with MAC Address: XXX has IP = and Link Speed = and Link Cost = Node with MAC Address: YYY has IP = ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: regex multiple lines
by davido (Cardinal) on Jan 30, 2012 at 19:12 UTC | |
Re: regex multiple lines
by JavaFan (Canon) on Jan 30, 2012 at 18:49 UTC | |
by dlal66 (Acolyte) on Jan 30, 2012 at 19:47 UTC | |
Re: regex multiple lines
by choroba (Cardinal) on Jan 30, 2012 at 18:54 UTC |
Back to
Seekers of Perl Wisdom