Re: regex to get version from file name

2014-02-23 Thread Wernher Eksteen
Great thank you! On Fri, Feb 21, 2014 at 6:02 PM, Jim Gibson wrote: > > On Feb 21, 2014, at 6:21 AM, Wernher Eksteen wrote: > > > Hi all, > > > > From the below file names I only need the version number 1.2.4 without > explicitly specifying it. > > > > check_mk-1.2.4.tar.gz > > check_mk-agen

Re: regex to get version from file name

2014-02-23 Thread Wernher Eksteen
Thanks, this also worked for me... foreach my $i (@fileList) { push @versions, $i =~ m/\b(\d+\.\d+\.\d+)\b/g; } my %seen; my @unique = grep { ! $seen{$_}++ } @versions; On Sun, Feb 23, 2014 at 4:27 PM, Jim Gibson wrote: > > On Feb 23, 2014, at 5:10 AM, Wernher Eksteen wrote: > > > H

Re: regex to get version from file name

2014-02-23 Thread Jim Gibson
On Feb 23, 2014, at 5:10 AM, Wernher Eksteen wrote: > Hi, > > Thanks, but how do I assign the value found by the regex to a variable so > that the "1.2.4" from 6 file names in the array @fileList are print only > once, and if there are other versions found say 1.2.5 and 1.2.6 to print the >

Re: regex to get version from file name

2014-02-23 Thread Jim Gibson
On Feb 21, 2014, at 6:21 AM, Wernher Eksteen wrote: > Hi all, > > From the below file names I only need the version number 1.2.4 without > explicitly specifying it. > > check_mk-1.2.4.tar.gz > check_mk-agent-1.2.4-1.noarch.rpm > check_mk-agent-logwatch-1.2.4-1.noarch.rpm > check_mk-agent-

Re: regex to get version from file name

2014-02-23 Thread Wernher Eksteen
Thanks, I've changed it to use LWP. I'm not sure how to download the actual file with LWP, so I've tried File::Fetch which works, but it doesn't show download progress/status etc, just hanging blank until the download completes. Any pointers on getting download status/progress details? foreach my

Re: regex to get version from file name

2014-02-23 Thread shawn wilson
Use LWP to get web data - not lynx and the like unless you can't help it. I prefer using Web::Scraper to parse html but either way it's probably best not to use a regex (see SO and similar for discussions on the like). On Feb 23, 2014 8:13 AM, "Wernher Eksteen" wrote: > > Hi, > > Thanks, but how

Re: regex to get version from file name

2014-02-23 Thread Wernher Eksteen
Hi, Thanks, but how do I assign the value found by the regex to a variable so that the "1.2.4" from 6 file names in the array @fileList are print only once, and if there are other versions found say 1.2.5 and 1.2.6 to print the unique values from all. This is my script thus far. The aim of this s

Re: regex to get version from file name

2014-02-21 Thread Shawn H Corey
On Fri, 21 Feb 2014 16:21:57 +0200 Wernher Eksteen wrote: > Hi all, > > From the below file names I only need the version number 1.2.4 without > explicitly specifying it. > > check_mk-1.2.4.tar.gz > check_mk-agent-1.2.4-1.noarch.rpm > check_mk-agent-logwatch-1.2.4-1.noarch.rpm > check_mk-ag

regex to get version from file name

2014-02-21 Thread Wernher Eksteen
Hi all, >From the below file names I only need the version number 1.2.4 without explicitly specifying it. check_mk-1.2.4.tar.gz check_mk-agent-1.2.4-1.noarch.rpm check_mk-agent-logwatch-1.2.4-1.noarch.rpm check_mk-agent-oracle-1.2.4-1.noarch.rpm mk-livestatus-1.2.4.tar.gz mkeventd-1.2.4.tar