I want the version number from the output and for both the output I want one code only
Edition: Read the output starts with Cisco till Version then extract the Version Number
For example:Read the line like this Cisco IOS Software, s2t54 Software (s2t54-ADVIPSERVICESK9-M), Version 15.5(1)SY2, the ouput Version
Output : 15.5(1)SY2
Output 1: ''' Cisco IOS Software, s2t54 Software (s2t54-ADVIPSERVICESK9-M), Version 15.5(1)SY2, RELEASE SOFTWARE (fc6) ROM: System Bootstrap, Version 12.2(50r)SYS3, RELEASE SOFTWARE (fc1) CPU: MPC8572_E, Version: 2.2, (0x80E80022) CORE: E500, Version: 3.0, (0x80210030) '''
Output 2: Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500es8-UNIVERSALK9-M), Version 03.08.07.E RELEASE SOFTWARE (fc2) licensed under the GNU General Public License ("GPL") Version 2.0. The software code licensed under GPL Version 2.0 is free software that comes GPL code under the terms of GPL Version 2.0.
I tried ths code:
r = re.findall(r'Version\s*(([\w]+))', str)
r[0]
it gives output:
15.5
03.08.07.E
expected output:
15.5(1)SY2
03.08.07.E