I have several hundred lines of firmware I'm parsing out and have gotten them all with the exception of three.
#!/usr/bin/perl
use strict;
use warnings;
my @array = ();
while (<DATA>) {
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, Produ
+ct: RDT-8, Version: rdtg7.0.4.7, HardwareRevision: A
Motorola Corporation SB4100E Cable Modem: Hardware version: 0; OS: VxW
+orks 5.3.1; Software version: 4.1.4p
<<HW_REV: 0; VENDOR: Motorola; BOOTR: CG4D_05.3.02; SW_REV: CG4D_05.3.
+02; MODEL: SBV4200>>OS: VxWorks 5.4
Any suggestions are appreciated!