| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
Using GNU sed 4.2.2-4ubuntu1 on Ubuntu 14.04 LTS GNU/Linux
I have some blocks of text spread over multiple lines and delimited by [
and ]. ( See the tail of the message for an example. ) I'd like to
delete the nth [ ] block. The following pattern will delete all [ ] blocks:
sed '/^\[$/,/^\]/d' in > out
That deletes more than I want deleted. How can I make a sed formula or
two that only deletes the nth block and leaves the others?
Regards,
/Lars
###
foo
[
aaa
bbb
ccc
]
[
ccc
bbb
aaa
]
[
bbb
ccc
aaa
]
[
bbb
aaa
ccc
]
bar
###