Timeline for sed command works with e flag but not with E
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 21, 2019 at 7:41 | vote | accept | Prvt_Yadav | ||
| Sep 21, 2019 at 0:24 | comment | added | Adam D. | You can drop the "-e", it's only if you have separate expressions. The -E option would work if you escaped the "$"'s. | |
| Sep 20, 2019 at 19:53 | history | became hot network question | |||
| Sep 20, 2019 at 13:06 | answer | added | Philippos | timeline score: 5 | |
| Sep 20, 2019 at 13:02 | comment | added | cas |
sed's -E and -e options are two completely different and unrelated things. they are not alternate versions of each other. -e tells sed that the next argument is a script to be run. -E tells sed to use extended regular expressions (ERE) instead of sed's default of basic regular expressions (BRE).
|
|
| Sep 20, 2019 at 12:29 | comment | added | steeldriver |
The [ and ] must be escaped in both BRE and ERE (otherwise they define a range expression). As to why you get no output when escaping them and using ERE, I think it's a difference in how $ is treated between BRE and ERE when it's not the final character of a pattern - see for example Bash sed replace double dollar sign $$ extended regular expressions
|
|
| Sep 20, 2019 at 11:47 | history | asked | Prvt_Yadav | CC BY-SA 4.0 |