package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(VRP.+|Cisco\sIOS.+)(Version\s\S+)|(HUAWEI\s\S+|cisco\s\S+)`)
var str = `<RMCOVTA0201>dis ver
Huawei Versatile Routing Platform Software
VRP (R) software, Version 8.10 (CX600 V800R007C10)
Copyright (C) 2012-2014 Huawei Technologies Co., Ltd.
HUAWEI CX600-X2-M16 uptime is 902 days, 1 hour, 17 minutes
CX600-X2-M16 version information:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BKP version information:
PCB Version : CX68BKP03B REV B
MPU Slot Quantity : 2
NPU Slot Quantity : 2
CARD Slot Quantity : 16
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MPU version information:
MPU (Master) 19 : uptime is 902 days, 1 hour, 16 minutes
StartupTime 2015/04/16 19:22:14
SDRAM Memory Size : 2048 M bytes
FLASH Memory Size : 16 M bytes
NVRAM Memory Size : 4096 K bytes
CFCARD Memory Size : 2048 M bytes
CX6D00MPUK70 version information:
PCB Version : CX68MPUK REV B
EPLD Version : 106
FPGA Version : 107
BootROM Version : 03.47
BootLoad Version : 03.47
MPU (Slave) 20 : uptime is 902 days, 1 hour, 14 minutes
StartupTime 2015/04/16 19:24:06
SDRAM Memory Size : 2048 M bytes
FLASH Memory Size : 16 M bytes
NVRAM Memory Size : 4096 K bytes
CFCARD Memory Size : 2048 M bytes
CX6D00MPUK70 version information:
PCB Version : CX68MPUK REV B
EPLD Version : 106
FPGA Version : 107
BootROM Version : 03.47
BootLoad Version : 03.47
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NPU version information:
NPU 17 : uptime is 902 days, 1 hour, 14 minutes
StartupTime 2015/04/16 19:24:17
Host processor :
SDRAM Memory Size : 2048 M bytes
Flash Memory Size : 128 M bytes
LPU CR5DNPU12070 version information:
PCB Version : CX68NPU120A REV BCisco IOS XR Software, Version 5.1.3[Default]
RP/0/RSP0/CPU0:RMCOCEM0101#sh ver
Wed Oct 4 12:47:21.939 BRT
Cisco IOS XR Software, Version 5.1.3[Default]
Copyright (c) 2015 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.75(c) 1994-2012 by Cisco Systems, Inc.
RMCOCEM0101 uptime is 39 weeks, 2 hours, 6 minutes
System image file is "disk0:asr9k-os-mbi-5.1.3.CSCur21570-1.0.0/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2127MHz, Revision 2.174
ASR 9006 DC Chassis with PEM Version 2
4 Management Ethernet
40 GigabitEthernet
8 TenGigE
8 DWDM controller(s)
8 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6220M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).
Configuration register on node 0/RSP0/CPU0 is 0x2102
Boot device on node 0/RSP0/CPU0 is disk0:
Package active on node 0/RSP0/CPU0:
iosxr-fwding-5.1.3.CSCur07854, V 1.0.0[SMU], Cisco Systems, at disk0:iosxr-fwding-5.1.3.CSCur07854-1.0.0
Built on Fri Oct 17 03:14:03 BRT 2014
By iox-bld1 in /scratch1/smu/EFR/smu_r51x_5_1_3/workspace for pie
RP/0/RSP0/CPU0:RTARRCE0202#sh ver
Wed Oct 4 13:06:41.766 BRT
Cisco IOS XR Software, Version 5.1.3[Default]
Copyright (c) 2015 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.71(c) 1994-2012 by Cisco Systems, Inc.
RTARRCE0202 uptime is 1 year, 28 weeks, 8 hours, 58 minutes
System image file is "disk0:asr9k-os-mbi-5.1.3.CSCuv70838-1.0.0/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2128MHz, Revision 2.174
ASR 9006 DC Chassis with PEM Version 2
2 Management Ethernet
20 TenGigE
20 DWDM controller(s)
20 WANPHY controller(s)
20 GigabitEthernet
503k bytes of non-volatile configuration memory.
6271M bytes of hard disk.
11817968k bytes of disk0: (Sector size 512 bytes).
11817968k bytes of disk1: (Sector size 512 bytes).
Configuration register on node 0/RSP0/CPU0 is 0x2102
Boot device on node 0/RSP0/CPU0 is disk0:
Package active on node 0/RSP0/CPU0:
iosxr-fwding-5.1.3.CSCux30811, V 1.0.0[SMU], Cisco Systems, at disk0:iosxr-fwding-5.1.3.CSCux30811-1.0.0
Built on Fri Dec 11 19:52:18 BRTSUMMERTIME 2015
By iox-lnx-008 in /san1/smu/EFR/smu_r51x_5_1_3/workspace for pie
asr9k-px-5.1.3.CSCux30811, V 1.0.0[SMU], Cisco Systems, at disk0:asr9k-px-5.1.3.CSCux30811-1.0.0
Built on Fri Dec 11 19:52:21 BRTSUMMERTIME 2015
By iox-lnx-008 in /san1/smu/EFR/smu_r51x_5_1_3/workspace for pie
BFGME10#sh ver
Cisco IOS Software, c7600rsp72043_rp Software (c7600rsp72043_rp-ADVENTERPRISEK9-M), Version 15.3(3)S4, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Compiled Fri 19-Sep-14 01:29 by prod_rel_team
ROM: System Bootstrap, Version 12.2(33r)SRE2, RELEASE SOFTWARE (fc1)
BOOTLDR: Cisco IOS Software, c7600rsp72043_rp Software (c7600rsp72043_rp-ADVENTERPRISEK9-M), Version 15.3(3)S4, RELEASE SOFTWARE (fc1)
BFGME10 uptime is 2 years, 14 weeks, 14 hours, 24 minutes
Uptime for this control processor is 2 years, 14 weeks, 12 hours, 59 minutes
System returned to ROM by power cycle (SP by power on)
System restarted at 23:57:22 UTC Sun Jun 28 2015
System image file is "sup-bootdisk:/c7600rsp72043-adventerprisek9-mz.153-3.S4.bin"
Last reload type: Normal Reload
Last reload reason: power-on
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
<RMAGLRA-LMPN02-01>dis
<RMAGLRA-LMPN02-01>display ver
Huawei Versatile Routing Platform Software
VRP (R) software, Version 8.10 (CX600 V800R007C10)
Copyright (C) 2012-2014 Huawei Technologies Co., Ltd.
HUAWEI CX600-X2-M8 uptime is 434 days, 2 hours, 3 minutes
CX600-X2-M8 version information:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BKP version information:
PCB Version : CX68BKP02B REV B
MPU Slot Quantity : 2
NPU Slot Quantity : 2
CARD Slot Quantity : 8
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MPU version information:
`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/