I got this sed regex I found:
sed '/start/!d;s//&\n/;s/.*\n//;:a;/end/bb;$!{n;ba};:b;s//\n&/;P;D'
which basically outputs the content that is between a starting point and an end point.
##1##
this is a test
with multiple
line
##z##
and replacing start
with ##1##
, and end
to ##z##
would give:
this is a test
with multiple
line
If there are multiple occurrences of the ##1##
and ##z##
, then it would obviously show all the in-between text of said occurrence, like so:
##1##
this is a test
with multiple
line
##z##
##1##
this is a test
with multiple
line
##z##
to
this is a test
with multiple
line
this is a test
with multiple
line
To clarify even more:
##1##
this is a test
with multiple
line
##z##
##2##
test
##z##
would obviously give only what is specified as starting point (since the ending point ##z##
is always the same).
So if i use ##2##
instead as starting point:
test
This would give the above as output.
My goal is to convert this to a compatible regex for vim. I'm using this site and the local manual as help but, I'm unsure where to start for converting the above to vim regex.
##1##
and##z##
? Please use a more complete example. – Quasímodo Sep 8 '20 at 20:28