TIL that
ed(1) requires me to escape (, ), {, }, <, and > in a regex to not use them as literal characters. This is the exact opposite of what I would expect.Guy Geens likes this.
Boyd Stephen Smith Jr.
in reply to Jonathan Lamothe • • •Basic vs. Extended regular expressions.
sed (and evidently ed) use basic regular expressions
awk uses extended regular expressions.
grep defaults to basic, with `-E` using extended.
Since those characters are also special to the shell, you might see them escaped from that purpose, even when they appear in a sed/grep command line.
Jonathan Lamothe
in reply to Boyd Stephen Smith Jr. • •edin interactive mode, no shell involved.Boyd Stephen Smith Jr.
in reply to Jonathan Lamothe • • •Yes, like I said, in basic regular expressions those characters only have special meaning when escaped. In extended regular expressions, they have special meaning unless escaped.
Both types of regular expressions are well documented in the latest Single UNIX Specification from The Open Group. Older versions of SUS are available from Debian contrib (or non-free?).