Sample data:
$ cat -n strings.dat
1 a
2 b
3 s
4 start
5 text
6 more text
7 end of more text
8 end
9 even more text
10 end
One awk
solution using a range (similar to RavinderSingh13's post) that prints out OP's textual message at the end:
startstring="start" # define start of search block
awk -v ss="${startstring}" ' # pass start of search block in as awk variable "ss"
# search for a range of lines between "ss" and "end":
$0==ss,/^end$/ { if ($0==ss && x==0 ) x=FNR # if this is the first line of the range make note of the line number
print # print the current line of the range
if ($0=="end") # if this is the last line of the range then print our textual message re: start/finish line numbers
printf "\nThe content is between lines %d and %d.\n",x,FNR
}
' strings.dat
NOTE: the $0==ss
and /^end$/
tests assume no leading/trailing white space in the data file otherwise these tests will fail and there will be no range match.
With startstring="start"
this generates:
start
text
more text
end of more text
end
The content is between lines 4 and 8.
With startstring="more text"
this generates:
more text
end of more text
end
The content is between lines 6 and 8.
With startstring="even more text"
this generates:
even more text
end
The content is between lines 9 and 10.
With startstring="water"
this generates:
--no output--
NOTE: If OP uses startstring="end"
the results are not as expected; while it would be possible to add more code to address this scenario I'm going to skip this scenario for the time being.