As mentioned I am using posh-SSH to connect my UCS fabric-interconnect (switch) over SSH and run the command to check the uptime of the IOM modules. The 1st command is "connect iom 1" which will be the below output from which I need only the "Attaching to FEX 1 ..." portion.
Attaching to FEX 1 ...
To exit type 'exit', to abort type '$.'
Bad terminal type: "dumb". Will assume vt100.
fex-1#
2nd command is "sh system uptime" and it gives the following output:
System start time: Sat Sep 12 12:45:21 2021
System uptime: 101 days, 0 hours, 11 minutes, 32 seconds
Kernel uptime: 101 days, 0 hours, 22 minutes, 11 seconds
fex-1#
I need the 2 lines in the middle to be saved on variable from the above output
Lastly exit command to come out from fex-1# prompt
This way it should print for the uptime of all 10 IOM modules present in the UCSM.