Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Any suggestions are appreciated!#!/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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: RegEx advice needed
by talexb (Chancellor) on Oct 23, 2003 at 19:04 UTC | |
Re: RegEx advice needed
by monktim (Friar) on Oct 23, 2003 at 19:01 UTC | |
Re: RegEx advice needed
by TomDLux (Vicar) on Oct 23, 2003 at 19:03 UTC | |
Re: RegEx advice needed
by zby (Vicar) on Oct 23, 2003 at 19:06 UTC | |
Re: RegEx advice needed
by Anonymous Monk on Oct 23, 2003 at 19:14 UTC | |
by monktim (Friar) on Oct 23, 2003 at 20:23 UTC |