I was trying to match/output all the text before the first
sed -i -r 's/^([^\]]*).*/\1/' "$FILE.tmp"
Which surprisingly does not work.
However, searching for the other bracket does work:
sed -i -r 's/^([^\*).*/\1/' "$FILE.tmp"
Is this a sed bug or am I doing it wrong?
I know I can work around this using
.*? which is good enough but this issue had me stumped for long enough that I'd like to know if there is something I missed.
(According --version, I am using GNU sed 4.2.2.)