the sed pattern to extract octave version

majorversion := $(shell mkoctfile --version 2>&1 |sed -e 's/^.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\1/g') minorversion := $(shell mkoctfile --version 2>&1 |sed -e 's/^.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\2/g') microversion := $(shell mkoctfile --version 2>&1 |sed -e 's/^.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\3/g')

fails on development due to unexpected "+"


$ mkoctfile --version
mkoctfile, version 3.5.91+

a two passes sed can handle also this case

majorversion := $(shell mkoctfile --version 2>&1 | sed -e 's/[ .+]/\n/g' |sed -n '3p') minorversion := $(shell mkoctfile --version 2>&1 | sed -e 's/[ .+]/\n/g' |sed -n '4p') microversion := $(shell mkoctfile --version 2>&1 | sed -e 's/[ .+]/\n/g' |sed -n '5p')

patch attached

Marco
--- sockets-1.0.7_old/src/Makefile      2009-08-27 19:23:57.000000000 +0200
+++ sockets-1.0.7/src/Makefile  2011-12-31 08:15:05.174698500 +0100
@@ -3,9 +3,9 @@
 
 #See which octave version we run by querying mkoctfile for its version
 #string. (Is there a better way to do this? This looks horrible.) 
-majorversion :=$(shell mkoctfile --version 2>&1 |sed -e 's/^.* 
\([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\1/g')
-minorversion:=$(shell mkoctfile --version 2>&1 |sed -e 's/^.* 
\([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\2/g')
-microversion:=$(shell mkoctfile --version 2>&1 |sed -e 's/^.* 
\([0-9]*\)\.\([0-9]*\).\([0-9]*\)$$/\3/g')
+majorversion := $(shell  mkoctfile --version 2>&1  | sed  -e 's/[ .+]/\n/g' 
|sed  -n '3p')
+minorversion := $(shell  mkoctfile --version 2>&1  | sed  -e 's/[ .+]/\n/g' 
|sed  -n '4p')
+microversion := $(shell  mkoctfile --version 2>&1  | sed  -e 's/[ .+]/\n/g' 
|sed  -n '5p')
 
 VFLAGS=-DMAJORVERSION=$(majorversion) 
 VFLAGS+=-DMINORVERSION=$(minorversion)
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to