Thanks for taking the trouble to reply zaxxon, but I was really hoping to use sed rather than awk.
Michael, many thanks to you too - this works like a charm. Any chance of an explanation or pointing me in the direction of some further reading so I might understand what is happening!
Thanks - I'm reading the sed pages at grymoire at the moment, and having a play with your sed to try and gain a better understanding.
If the text varies, however, it fails:
#limerick There was a young lady from Nantucket..
\images\Blank.jpg
Blank
:end
#joke A horse walked into a bar,
and the barman said
\images\Blank.jpg
:end
other text #joke A bear and a rabbit.
\images\Blank.jpg
:end
to
#limerick There was a young lady from Nantucket..
\images\limerick.jpg
limerick
:end
#joke A horse walked into a bar,
and the barman said
\images\joke.jpg
:end
other text #joke A bear and a rabbit.
\images\joke.jpg
:end
using something like
/#\w+/,/:end/
to define a start/stop could suit my need better. Is this possible?