Trying to use extended regular expressions and I'm getting mixed results (neither of which is correct) between FreeBSD 12.2 and 13.0 vs Linux (working).
FreeBSD 12.2:
FreeBSD 13.0:
Linux:
Can someone tell me what I'm doing wrong?
Update: If I install 'gsed' it works perfectly!!!
FreeBSD 12.2:
# echo 'abcd' | sed -r 's/(\w)(.*)/\1/'
abcd
FreeBSD 13.0:
# echo 'abcd' | sed -r 's/(\w)(.*)/\1/'
sed: 1: "s/(\w)(.*)/\1/": RE error: trailing backslash (\)
Linux:
# echo 'abcd' | sed -r 's/(\w)(.*)/\1/'
a
Can someone tell me what I'm doing wrong?
Update: If I install 'gsed' it works perfectly!!!