RE: A little regex help please ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, that's exactly what I needed!!!!

:b!

Brian D. McGrew { brian@xxxxxxxxxxxxx || brian@xxxxxxxxxxxxxxxxxxx }
--
> This is a test.  This is only a test!
  Had this been an actual emergency, you would have been
  told to cancel this test and seek professional assistance!

-----Original Message-----
From: fedora-list-bounces@xxxxxxxxxx
[mailto:fedora-list-bounces@xxxxxxxxxx] On Behalf Of Eric Brunson
Sent: Monday, July 10, 2006 10:20 AM
To: For users of Fedora Core releases
Subject: Re: A little regex help please ...


I think this is what you want:
$ sed 's/\([0-9]\.[0-9]\(\.[0-9]\)*\).*/\1/' <<.EOF   
 > 5.1
 > 5.1.1
 > 5.1.1-LINUX
 > 5.1.1-FC3
 > 5.1.1-RH73
 > 5.1.1_debug
 > 5.1.1_debug_O1G
 > 5.1.2
 > 5.1.2-LINUX
 > 5.1.2-FC3
 > 5.1.2-RH73
 > 5.1.2_debug
 > 5.1.2_debug_O1G
 > .EOF
5.1
5.1.1
5.1.1
5.1.1
5.1.1
5.1.1
5.1.1
5.1.2
5.1.2
5.1.2
5.1.2
5.1.2
5.1.2


So in your script:
release=$( echo $directory | sed 's/\([0-9]\.[0-9]\(\.[0-9]\)*\).*/\1/'
)

Brian D. McGrew wrote:
> Morning all,
>
> I'm in a shell script (hey, it's dark in here) in the middle of a 'for
f
> in *' loop and I walking through a list of directories that looks
like:
>
> 5.1
> 5.1.1
> 5.1.1-LINUX
> 5.1.1-FC3
> 5.1.1-RH73
> 5.1.1_debug
> 5.1.1_debug_O1G
> 5.1.2
> 5.1.2-LINUX
> 5.1.2-FC3
> 5.1.2-RH73
> 5.1.2_debug
> 5.1.2_debug_O1G
>
> All of these start with a number.  I'm looking for a simple regex to
> pick off everything up to and including the last numerical value and
> throw away everything after the last numerical value.
>
> Regex has always been a mystery to me, any help would be great!
>
> TIA,
>
> :b!
>
> Brian D. McGrew { brian@xxxxxxxxxxxxx || brian@xxxxxxxxxxxxxxxxxxx }
> --
>   
>> This is a test.  This is only a test!
>>     
>   Had this been an actual emergency, you would have been
>   told to cancel this test and seek professional assistance!
>
>
>   

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux