I'm fairly new to scripting so this might not be possible.
I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue " show version
" on a Nexus switch, I'm looking to capture the current firmware version:
#show version
[...]
Software
BIOS: version 3.6.0
loader: version N/A
kickstart: version 7.0(7)N1(1)
system: version 7.0(7)N1(1)
Power Sequencer Firmware:
[...]
In the output above, my expect script looks for: " system:
"
What I want to capture is: " 7.0(7)N1(1)
" or what ever is actually returned.
I have tried using the $expect_out(0,string) without success. I have used $expect_out(buffer), but that captures way more data than I'm looking for and really don't know how to select data that gets sent to the buffer.
Thanks in advance for any advice.