Ralph, Try sed -n -E -e '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p' (or its equivalent in Perl).
-n = Don't print out lines that do not match the pattern -E = Telsl sed to recognize + pattern = <digits>.<digits>.<digits> (no attempt to rule out nonsense like 0.0.0) > savaii:~ baker$ m4 --version > GNU M4 1.4.6 > Copyright (C) 2006 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > Written by Rene' Seindal. > > savaii:~ baker$ m4 --version | sed -n -E -e > '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p' > 1.4.6 > savaii:~ baker$ gcc --version > i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) > Copyright (C) 2007 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > savaii:~ baker$ gcc --version | sed -n -E -e > '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p' > 4.2.1 > savaii:~ baker$ flex --version > flex 2.5.35 > > savaii:~ baker$ flex --version | sed -n -E -e > '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p' > 2.5.35 To match Ralph's sample failure: > savaii:~ baker$ echo "flex 2.5.35 Apple(flex-31)" | sed -n -E -e > '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p' > 2.5.35 Larry Baker US Geological Survey 650-329-5608 ba...@usgs.gov On 14 Nov 2012, at 3:26 PM, Ralph Castain wrote: > Sorry Nathan - I had to revert this out as it broke builds on Mac ML. The > problem is that the find_and_check parser looks for parens to find the > version number, expecting something like this: > > $ m4 --version > m4 (GNU M4) 1.4.16 > > or this: > > $ gcc --version > i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 > > However, on Mac ML, you get this for flex: > > $ flex --version > flex 2.5.35 Apple(flex-31) > > And so the parser incorrectly rejects the flex version. We'll have to come up > with a more robust way of getting version numbers so we can do this test. > > > > On Nov 12, 2012, at 11:28 PM, svn-commit-mai...@open-mpi.org wrote: > >> Author: hjelmn (Nathan Hjelm) >> Date: 2012-11-13 02:28:10 EST (Tue, 13 Nov 2012) >> New Revision: 27601 >> URL: https://svn.open-mpi.org/trac/ompi/changeset/27601 >> >> Log: >> enforce minimum flex version in autogen.pl >> >> Text files modified: >> trunk/autogen.pl | 4 ++++ >> 1 files changed, 4 insertions(+), 0 deletions(-) >> >> Modified: trunk/autogen.pl >> ============================================================================== >> --- trunk/autogen.pl Tue Nov 13 02:21:10 2012 (r27600) >> +++ trunk/autogen.pl 2012-11-13 02:28:10 EST (Tue, 13 Nov 2012) (r27601) >> @@ -56,11 +56,13 @@ >> my $ompi_automake_version = "1.11.1"; >> my $ompi_autoconf_version = "2.65"; >> my $ompi_libtool_version = "2.2.6b"; >> +my $ompi_flex_version = "2.5.35"; >> >> # Search paths >> my $ompi_autoconf_search = "autoconf"; >> my $ompi_automake_search = "automake"; >> my $ompi_libtoolize_search = "libtoolize;glibtoolize"; >> +my $ompi_flex_search = "flex"; >> >> # One-time setup >> my $username; >> @@ -797,6 +799,7 @@ >> GNU Autoconf: $ompi_autoconf_version >> GNU Automake: $ompi_automake_version >> GNU Libtool: $ompi_libtool_version >> + Flex: $ompi_flex_version >> =================================================================\n"; >> my_exit(1); >> } >> @@ -1015,6 +1018,7 @@ >> &find_and_check("autoconf", $ompi_autoconf_search, $ompi_autoconf_version); >> &find_and_check("libtool", $ompi_libtoolize_search, $ompi_libtool_version); >> &find_and_check("automake", $ompi_automake_search, $ompi_automake_version); >> +&find_and_check("flex", $ompi_flex_search, $ompi_flex_version); >> >> #--------------------------------------------------------------------------- >> >> _______________________________________________ >> svn mailing list >> s...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/svn > > > _______________________________________________ > devel mailing list > de...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/devel