in reply to Matching range of text with another string in between

perl -ne "BEGIN{print scalar <> for 1..14} END{print +(split /^/, $x)[ +-3..-1]} $x = $x x !/\QLX*/ . $_; /\QCAS*\E/ && print $x x $x =~ /000 +03/" "filename"

Replies are listed 'Best First'.
Re^2: Matching range of text with another string in between
by periodicalcoder (Novice) on Apr 27, 2016 at 21:29 UTC

    This works perfectly! Thank you for your patience and I can't adequately say how much I appreciate your help. I expect project creep with this but hopefully I'll be able to handle the rest on my own.

    Thank you all for your help!

      Also, in the future, details like the first 14 lines and the last 3 should be mentioned up front, because code can be very sensitive to such seemingly small requirements.

        Yes, I will be sure to do so. I realized that myself after the first reply or two.

      Thanks for letting me know it worked. Also, thanks for the interesting problem. :)