Reputation: 623
I'd like to delete all lines with 3 plus signs:
+++ 3 plus signs
+ 1 plus sign
+++ 3 plus signs
Here's my sed command, escaping the plus signs after beginning of line
sed '/^\+\+\+/d' -> This erase all lines
sed '/^+++/d' -> This works and show only the 1 plus sign line
Why? Is there any problem while escaping the plus sign?
Upvotes: 10
Views: 3672
Reputation: 8033
"A quick comment. The original sed did not support the "+" metacharacter. GNU sed does if you use the "-r" command line option, which enables extended regular expressions."
(Source)
If you don't use sed -r
, then you don't have to escape +
since it is not considered a metacharacter.
Upvotes: 10