Perl: Printing lines of a file between two delimiters
I need to print out the lines of a text file that are between a specific starting delimiter and and ending delimiter:
perl -nE 'print if /START_DELIMITER/../END_DELIMITER/' input.txt
or use this to exclude the delimiter lines
perl -nE '/END_DELIMITER/ and $y = 0; $y and print; /START_DELIMITER/ and $y = 1' input.txt
This method also works for data passed in via a pipe.