Re: A little regex help please ...

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

 



Brian D. McGrew wrote:
Yeah, you did understand but I should have been more clear because my release tress go way back and don't all begin with 5.  We go clear back to 3; so it could be

3.0
3.1
3.1-*
3.1_*
3.2
3.2-*
....
4.5
4.5-*
4.5_*
...
5.0
5.0-*
5.0_*

There is about 300 directories I'm walking through here.
I know you got another reply using other utilities, but since you asked for a regex command, I though this might be interesting. The sort -u is just there to take out any repeated numbers and then sort them alphanumerically.

ls | perl -n -e 'print "$1\n" if ( /([0-9.]+).*/ );' | sort -u

If you want to include the dashes and underscores in the listing, just change the regex to:

/([0-9.]+[-_]?).*/

Justin Willmert


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux