#!/usr/bin/perl use strict; use warnings; my @array = (); while () { push @array, $1 if ( /Version:?\s*([^\s,]+)/i ); push @array, $1 if ( /SW:?\s*$|SW_REV:?\s*([^.]+)/ ); push @array, $1 if ( /Rev\s*$|\s+Revision:?\s*([^\s,]+)/i ); } foreach (@array) { $_ =~ s/Copyright//i; print "FW: $_\n"; } # OUTPUT IS: #FW: rdtg7.0.4.7 #FW: 0; #FW: CG4D_05 #OUTPUT SHOULD BE #FW: rdtg7.0.47 #FW: 4.1.4p #FW: CG4D_05.3.02 __DATA__ Company: Nuera Communications, Inc., ProductFamily: ORCA Series, Product: RDT-8, Version: rdtg7.0.4.7, HardwareRevision: A Motorola Corporation SB4100E Cable Modem: Hardware version: 0; OS: VxWorks 5.3.1; Software version: 4.1.4p <>OS: VxWorks 5.4