#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array = (); while () { push @array, $1 if m[Version\s+(.*)\,.*]i; push @array, $1 if m[Version\:\s+(.*)\s+PROM\.*]; } print Dumper (@array); # Array should be: # 12.2(15)T8 # 2.2.0.1 # 9.0.0.2 # 6.3(7) # 5.0.0.3 # 2.1.2.1 # E5.8.0.3 # 1.00.00 S # 12.0(14) __DATA__ Cisco Internetwork Operating System Software IOS (tm) 7200 Software (C7200-JS-M), Version 12.2(15)T8, RELEASE SOFTWARE (fc2) TAC Support: http://www.cisco.com/tac Copyright (c) 1986-2003 by cisco Systems, Inc. Compiled Tue 09-Sep-03 18:47 by pwade Cabletron Systems, Inc. Firmware Version: 2.2.0.1 PROM Version: prom-1.1.0.5 RS 3000 - Riverstone Networks, Inc. Firmware Version: 9.0.0.2 PROM Version: prom-2.0.1.3 Cisco Systems WS-C5000 Cisco Catalyst Operating System Software, Version 6.3(7) Copyright (c) 1995-2002 by Cisco Systems X-Pedition Security Router XSR-1805 version 5.0.0.3 Cabletron ELS100-24TXG SW:2.1.2.1 2521 Testing - Foo Company Firmware Version: E5.8.0.3 PROM Version: prom-P1.3.2.1 Cabletron ELS100-24TX SW: 1.00.00 S Cisco Internetwork Operating System Software IOS (tm) 4000 Software (C4000-IS-M), Version 12.0(14), RELEASE SOFTWARE (fc1) Copyright (c) 1986-2000 by cisco Systems, Inc. Compiled Wed 01-Nov-00 00:06 by linda