It looks like the new version of OS X no longer supports grep -P and as such has made some of my scripts stop working, for example:
var1=`grep -o -P '(?<=<st:italic>).*(?=</italic>)' file.txt`
I need to capture grep's result to a variable and I need to use zero-width assertions, as well as \K:
var2=`grep -P -o '(property:)\K.*\d+(?=end)' file.txt`
Any alternatives would be greatly appreciated.
-P? Mine has it.grepactually changed fromgrep (GNU grep) 2.5.1in 10.7 togrep (BSD grep) 2.5.1-FreeBSDin 10.8. I guess it was because of GPL. The FreeBSDgrepis also based on GNUgrepand both versions ofgrepare from 2002.--labeland-u/--unix-byte-offetswere also removed in 10.8.-z/--decompress,-J/--bz2decompress,--exclude-dir,--include-dir,-S,-O, and-pwere added in 10.8.-Zchanged from--nullto--decompress.grepthat comes with OS X is from 2002, and wiki.freebsd.org/BSDgrep still says that "the only TODO item is improving performance", so yeah.time grep aa /usr/share/dict/words>/dev/nulltakes about 0.09 seconds with OS X's grep and about 0.01 seconds with a new GNU grep on repeated runs on my iMac.