- or download this
perl -00 -ne 'print if /--Begin--/ && /--End--/' file.txt
- or download this
Hello World
...
other stuff
This is a test
Good Bye
- or download this
--Begin--
Cat
and
Dog
--End--
- or download this
export REX="/--Begin--/ && /--End--/"
echo $REX
/--Begin--/ && /--End--/
- or download this
perl -00 -ne 'BEGIN {$rex = $ENV{REX}} print if qr($rex)' file.txt
- or download this
perl -00 -ne 'BEGIN {$rex = qr($ENV{REX})} print if $rex' file.txt