Looking at the regex documentation for OS X 10.7.4 (but should apply to OP's 10.8.2), it is mentioned in the last paragraph that
Obsolete (basic) regular expressions differ in several respects. |
is an ordinary character and there is no equivalent for its functionality...
... The parentheses for nested subexpressions are \(' and
)'...
sed
, without any options, uses basic regular expression (BRE).
To use |
in OS X or BSD's sed
, you need to enable extended regular expression (ERE) via-E
option, i.e.
sed -E 's/software-//g;s/-(licensetypeone|licensetypetwo).zip//g'
p/s: \|
in BRE is a GNU extension.
Alternative ways to extract version number
-
chop-chop (parameter expansion)
VERSION=${ZIP#software-}
VERSION=${VERSION%-license*.zip}
-
sed
VERSION=$(sed 's/software-\(.*\)-license.*/\1/' <<< "$ZIP")
You don't necessarily have to match strings word-by-word with shell patterns or regex.