This command runs fine:
$ sed -e '/foo/{g; d}' myfile
But this one has an error:
$ sed -e '/foo/{g; a bar}' myfile
sed: -e expression #1, char 0: unmatched `{'
What's wrong with it?
|
This command runs fine:
But this one has an error:
What's wrong with it? |
||||
| show 2 more comments |
|
The
You need to have the newline after the line of input. If you want more than one line, then quote the newline:
This goes back to the roots of |
|||
|
|
g;is just some substitute. – Qiang Li Dec 31 '11 at 4:16{d;a bar}if you think{g;a bar}is nonsensical. – Qiang Li Dec 31 '11 at 4:41{g;you are referring to spacing. The second letter clarifies the changes. What would the bar do?. And if thed;does something, which it might, I'm not sure what it is. But invoking anything in{is the very uncommon to say the least. If you want to do any of the 'normal' uses of sed, like working with in regexp, you wouldn't use any{}– TechZilla Dec 31 '11 at 5:51