Pip -n, 21 bytes
_@>--b@<dM(a^n--c+,e) Or, if 0-indexing is allowed...
Pip -n, 17 bytes:
_@>b@<dM(a^nc+,e) Explanation
Takes all five arguments as command-line args.
a-e are the 5 cmdline args; n is newline a^n Split a on newlines ,e Range(e) c+ Add c to each element ( ) Use the resulting range(c,c+e) to slice into the list of lines M To each line, map this function: _ The line @>b Slice, keeping indices b and greater @<d Slice, keeping indices less than d Print, joining on newlines (-n flag) The above solutions also assume the input is a perfect rectangle--i.e., the lines are all the same length. Otherwise, 2 extra bytes are needed (use -l instead of -n):
(Z(a^nZDsb+,d)c+,e) 0-indexed, 19 bytes (Z(a^nZDs--b+,d)--c+,e) 1-indexed, 23 bytes