/usr/src/perl/pod/perlfaq6/How_can_I_pul_out_lines_betwen.pod

How can I pull out lines between two patterns that are themselves on different lines?

Here's one way, using Perl's somewhat exotic .. operator:

    perl -ne 'print if /START/ .. /END/' file1 file2 ...

If you wanted text and not lines, you would use

    perl -0777 -pe 'print "$1\n" while /START(.*?)END/gs' file1 file2 ...

But if you want nested occurrences of START through END, you'll run up against the problem described in the question in this section on matching balanced text.