Paul,

1) I wasn't trying to solve the --version issue, only the parsing of the response.
2) I assumed from the initial e-mail that the broken parser was in a Perl script.  I'm not a Perl person, so I wrote the example regular expression parser in sed.

These commands were done on my Mac OS X 10.6 system.  I have no idea where the apps came from.  I know the sed, at least, does not recognize regular expressions documented for GNU sed (such as \< \> for begin/end word).  Maybe it is a BSD sed?

I was just trying to illustrate how to fix the broken parsing of Ralph's "flex --version".  Assuming the RE parser I wrote is satisfactory, it would have to be adapted to fit in the framework, i.e., it has to be portable.

Larry Baker
US Geological Survey
650-329-5608
baker@usgs.gov



On 14 Nov 2012, at 5:41 PM, Paul Hargrove wrote:

On Wed, Nov 14, 2012 at 6:26 PM, Larry Baker <baker@usgs.gov> wrote:
m4 --version | sed -n -E -e '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p'

 
There are STILL problems with this approach as it is TWICE specific to GNU software:

1) M4 on OpenBSD (maybe others) doesn't support a "--version" flag:
$ m4 --version | sed -n -E -e '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p'
m4: unknown option -- -
usage: m4 [-gPs] [-Dname[=value]] [-d flags] [-I dirname] [-o filename]
        [-t macro] [-Uname] [file ...]

2) sed on Solaris (maybe others) doesn't support a "-E" flag:
$ m4 --version | sed -n -E -e '1s/^.*[^A-Za-z0-9_-]?([0-9]+[.][0-9]+[.][0-9]+)[^A-Za-z0-9_-]?.*$/\1/p'
/bin/sed: illegal option -- E

-Paul

--
Paul H. Hargrove                          PHHargrove@lbl.gov
Future Technologies Group
Computer and Data Sciences Department     Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900

_______________________________________________
devel mailing list
devel@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel