in reply to Contents b/w two given text

Could define and redefine the record separator to be text1 and text2 respectively, e.g.:
perl -e '$/="text1"; <>; $/="text2"; $_=<>; chomp; print "$_\n";' < fi +le

One world, one people