I need to shell script a way to get the random unknown junk text out of a text file. I am stuck on how to do this because i don't know what the junk text will say. Basically i need to remove everything before, after, and in between the pieces. I want to keep the text that is inside the pieces.
--Begin file
random unknown junk text
----Begin Piece one ----
random important text
----End Piece one ----
random unknown junk text
----Begin Piece two ----
random important text
----End Piece two ----
random unknown junk text
----Begin Piece two ----
random important text
----End Piece two ----
random unknown junk text
end of file