Skip to content
Advertisement

Whats the difference between sed -E and sed -e

I’m working on some old code and I found that I used to use

JavaScript

but I now try

JavaScript

It seems to do the same thing, or does it? I kinda remember there being a reason I done it but I can’t remember and doing “man sed” doesn’t help as they don’t have anything about -E only -e that doesn’t make much sense ether.

JavaScript

I thought -e meant it would match with a regex…

JavaScript

Advertisement

Answer

From source code, -E is an undocumented option for compatibility with BSD sed.

JavaScript

And from manual, -E in BSD sed is used to support extended regular expressions.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement