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 \'
The name of the label terminates with the first literal newline, not at the semi-colon. There are two easy ways to solve the problem. Add literal newlines:
sed '/SUCCESSFUL/d
/\[java\]/!b label
s/\s\+\[java\]//
/^\s*$$/d; /Compiling/!d
:label
/^\s*$$/d
s/^/monitor: /'
Or use multiple -e
options:
sed -e '/SUCCESSFUL/d ; /\[java\]/!b label' \
-e 's/\s\+\[java\]//; /^\s*$$/d; /Compiling/!d' \
-e':label' -e'/^\s*$$/d; s/^/monitor: /'