I am looking for the best method to find specific text within a file and wrap other text around it from the Linux command line.
So for example the file may contain the following:
This
is
a
test.
anchor-start
text to wrap will is in here
anchor-end
So in the above example I want to find the text in between anchor-start and anchor-end and then wrap that text so that I end up with:
This
is
a
test.
anchor-start
wrapping-start
text to wrap will is in here
wrapping-end
anchor-end
I should also note that I am looking for a solution whereby if anchor-start is immediately followed by wrapping-start (i.e. the wrapping has already occurred) then it should not be duplicated.
This might work for you: