avtobiff / erlang-uuid

Erlang UUID
https://github.com/avtobiff/erlang-uuid
GNU Lesser General Public License v3.0
113 stars 77 forks source link

Sed: extra characters at the end of "p" command #3

Closed mweibel closed 12 years ago

mweibel commented 12 years ago

sed: 1: "/vsn/ {s/.*,\s*"\([0-9] ...": extra characters at the end of p command

when building on OSX

avtobiff commented 12 years ago

Hi!

On Tue, May 15, 2012 at 8:02 AM, Michael Weibel reply@reply.github.com wrote:

sed: 1: "/vsn/ {s/.*,\s*"\([0-9] ...": extra characters at the end of p command

when building on OSX

I don't have access to any OSX box.

Could you try the solution referenced at

http://superuser.com/questions/256898/sed-syntax-to-remove-xml

AFAICS it is basically splitting the expression into several, introducing more -e and quoting each part.

Thanks!

Best, Per


Reply to this email directly or view it on GitHub: https://github.com/avtobiff/erlang-uuid/issues/3

mweibel commented 12 years ago

Does that work for you:

diff --git a/Makefile b/Makefile
index 8cbfbbf..fbeaa22 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f

 APPFILE   := uuid.app
-VERSION   := $(shell sed -n '/vsn/ {s/.*,\s*"\([0-9][0-9.]*\)".*/\1/; p}' \
+VERSION   := $(shell sed -n -e '/vsn/ {s/.*,\s*"\([0-9][0-9.]*\)".*/\1/' -e 'p' -e '}' \
                          src/$(APPFILE).src)

 PREFIX    ?= /usr
avtobiff commented 12 years ago

This works on GNU as well.

Thank you!

Closing this issue.

metajiji commented 9 years ago

Just add ; symbol before }

For example:

VERSION   := $(shell sed -n '/vsn/ {s/.*,\s*"\([0-9][0-9.]*\)".*/\1/; p;}' \

I'm testing similar code on OS X Maverics.