Can you help me with this?

Hello guys,
I’m trying to write a script which has to enable/disable the BGP neighbor regarding it’s status. For instance I’ve got more than 200 BGP neighbors, but for some reason from time to time some sessions go to “active” state with no any info. The only way to restore this session is to disable/enable the bgp peer (it’s probably a firmware bug). Anyway, I’ve found a way to display this bgp peers with the following command:

/routing bgp peer print status where state=“active”

and it returns me a list of BGP neighbors as well as other information regarding BGP session. I have some experience with shell scripting (in linux) as well as Perl and PHP but this MT scripting languagehas nothing to do with them. Anyway, I need to parse the results from that line to get the ‘name’ value from each. After that, I have to execute the command:

/routing bgp peer disable $name && /routing bgp peer enable $name

:log info “BGP session to $name was successfully cleared!\n”;

I couldn’t find a way to do that. Any suggestions are welcome!

Thank you in advance!

BR,
Danail Petrov