I have file with unknown number of blocks of text consisting of starting keyword "Start", ending keyword "End" and optional text between them with one exact keyword "Disk" on every line and I need to get rid of the ones where there is nothing between them, see the example.
I am processing input like this:
Server1:Start Server1:End Server2:Start Disk1 Disk2 Server2:End Server3:Start Disk1 Server3:End
, and my desired output is this:
Server2:Start Disk1 Disk2 Server2:End Server3:Start Disk1 Server3:End
I know, that I can use 'awk' or 'sed' to find text between 2 lines, but I do not know what to do, if there are multiple occurrences of these 2 lines or if there is no text between these 2 lines.
I am running Ubuntu 17.10.
Looking forward to any help.
edit: I deleted the post first time, because I thought that I can do it using
sed -e '/Start/,/End/d', but this actually removes everything.