| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
On 26 Feb 2015 09:09:49 -0800, "[email protected] [sed-users]"
<[email protected]> wrote:
> I made one minor change (added \n to the regular expression) to Davide's
> solution, to make the script get rid of an extra line that was showing up
> in the output. This assumes you are using GNU sed, other sed versions
> might not recognize \n in the regular expression.
That fails if the block being removed is the last one and there are no
further lines in the file, so at least you should make it optional:
s/\[[^]]*\]\n\{0,1\}//3
On the other hand, if we can assume an input like the one given as sample,
there will always be something after the last block so the \n can stay
without changes.
--
D.