I recently found out that this simple sed
expression work fine on Linux or under Cygwin but fails on Mac with an "undefined label" error:
$ sed '/SUCCESSFUL/d ; /\[java\]/!b label; s/\s\+\[java\]//; /^\s*$$/d; /Compiling/!d; :label /^\s*$$/d; s/^/monitor: /'
sed: 1: "/SUCCESSFUL/d ; /\[java ...": undefined label 'label; s/\s\+\[java\]//; /^\s*$$/d; /Compiling/!d; :label /^\s*$$/d; s/^/monitor: /'
sed
on MacOS is a BSD variant with different options than the GNU counterpart. However man sed
clearly indicates the MacOS version of sed
supports labels, so why this error, and most important how to solve it?